home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 201-220 / scopedisk202 / bbbbs2 / rexx / bbbbs.baud < prev    next >
Text File  |  1995-03-19  |  117KB  |  4,296 lines

  1. /***         $VER: BBBBS.baud  version 2.0    2 Mar 1991  ()           ***/
  2. /***  copyright 1990 Richard Lee Stockton * FREELY DISTRIBUTABLE *     ***/
  3.  
  4. /*** BBS.baud   -   A sorta-full-featured BBS in rexx for Baudbandit   ***/
  5. /*** based on 'Answer.baud'. Thanks to Greg Cunningham for BaudBandit! ***/
  6.  
  7. /*** 'BBS:Information/BBBBS.doc' & rexx:bbsSYSOP.rexx for install info ***/
  8.  
  9.  
  10. /* If the QuickSortPort not found then try to run setup.rexx . */
  11.  
  12. IF ~show('P','QuickSortPort') THEN CALL setup.rexx();
  13.  
  14. /* If the QuickSortPort is STILL not found then we gotta quit. */
  15.  
  16. IF ~show('P','QuickSortPort') THEN SIGNAL DONE2
  17.  
  18.  
  19. /*-------------- VARIABLES ----------------------------------------------*/
  20.  
  21. bbsprefs.    = 0  /* start with all prefs OFF */
  22. lastread.    = 0
  23. dirnum       = 1
  24. linesperpage = 19
  25. level        = 0
  26. lastread.    = 0
  27. totwrit.     = 0
  28. lastbrowse   = 0
  29. warnings     = 0
  30. winnings     = 0
  31. nonstop      = 0
  32. newfilesdate = ''
  33. newpassword  = ''
  34. replysubj    = ''
  35. msgdir       = 1
  36. menuflag     = 1
  37. logonflag    = 1
  38. data.        = ''
  39.  
  40. /*-------------- TEXT ---------------------------------------------------*/
  41.  
  42. text.   = ''                 /* This is the user data structure by line */
  43. text.1  = '   Full Name'
  44. text.2  = '      Street'
  45. text.3  = 'City, ST Zip'
  46. text.4  = ' Voice Phone'
  47. text.5  = '    Password'
  48. text.6  = '    Protocol'
  49. text.7  = 'LinesPerPage'
  50. text.8  = ' Preferences'
  51. text.9  = '    Computer'
  52. text.10 = '   Interests'
  53. text.11 = 'Session Time'
  54. text.12 = 'FirstSession'
  55. text.13 = 'Last Session'
  56. text.14 = '      UpLoad'
  57. text.15 = '    Download'
  58. text.16 = '   Last File'
  59. text.17 = 'Ratio  Email'
  60. text.18 = '    Winnings'
  61. text.19 = '       Usage'
  62. text.20 = '       Level'
  63. text.21 = 'Exclude DIRS'
  64. text.22 = '   Msgs Read'
  65. text.23 = '   Msgs Writ'
  66.  
  67.  
  68. /* page control codes */
  69.  
  70. lineup='1B'x'M'
  71.  
  72.  
  73. /* try to trap everything */
  74.  
  75. SIGNAL ON BREAK_C
  76. OPTIONS RESULTS
  77. bps=getbaudrate();
  78. SIGNAL ON BREAK_E
  79. SIGNAL ON SYNTAX
  80. SIGNAL ON FAILURE
  81. OPTIONS FAILAT 25
  82.  
  83.  
  84. /*--------------- SETUP -----------------------------------------*/
  85.  
  86. name=''
  87. CR='0D'x
  88. LF='0A'x
  89.  
  90. SAY '       - Baud Bandit Bulletin Board System from Gramma Software -'CR
  91.  
  92. arg='s:CONFIG.BBS'
  93. IF ~EXISTS(arg) THEN arg='BBS:BBS_TEXT/CONFIG.BBS'
  94. IF readlines(arg 1) THEN
  95.   DO
  96.     MSG 's:CONFIG.BBS and BBS:BBS/CONFIG.BBS are both missing!'
  97.     SIGNAL DONE2
  98.   END
  99. compos=POS('/*',lynes.1)
  100. IF compos>0 THEN lynes.1=LEFT(lynes.1,compos-1)
  101. bbsname            = STRIP(lynes.1)
  102. sysop              = WORD(lynes.2,1)
  103. compos=POS('/*',lynes.3)
  104. IF compos>0 THEN lynes.3=LEFT(lynes.3,compos-1)
  105. exclusionlist      = STRIP(lynes.3)
  106. bbsdevice          = WORD(lynes.4,1)
  107. sysoplevel         = WORD(lynes.5,1)
  108. bbspath            = WORD(lynes.6,1)
  109. IF ~EXISTS(bbspath) THEN
  110.   DO
  111.     MSG bbspath 'does not exist!'
  112.     SIGNAL DONE2
  113.   END
  114. testchar=RIGHT(bbspath,1)
  115. IF testchar~='/' & testchar~=':' THEN bbspath=bbspath'/'
  116. CALL SETCLIP('BBS_path',bbspath)
  117.  
  118. msgpath            = WORD(lynes.7,1)
  119. IF ~EXISTS(msgpath) THEN
  120.   DO
  121.     MSG msgpath 'does not exist!'
  122.     SIGNAL DONE2
  123.   END
  124. testchar=RIGHT(msgpath,1)
  125. IF testchar~='/' & testchar~=':' THEN msgpath=msgpath'/'
  126. msgpath=msgpath'MSG'
  127.  
  128. libpath            = WORD(lynes.8,1)
  129. IF ~EXISTS(libpath) THEN
  130.   DO
  131.     MSG libpath 'does not exist!'
  132.     SIGNAL DONE2
  133.   END
  134. testchar=RIGHT(libpath,1)
  135. IF testchar~='/' & testchar~=':' THEN libpath=libpath'/'
  136.  
  137. spellpath          = WORD(lynes.9,1)
  138. IF bbsprefs.5 & ~EXISTS(spellpath) THEN
  139.   DO
  140.     MSG spellpath 'does not exist!'
  141.     bbsprefs.5=0
  142.   END
  143.  
  144. /* expansion config would go here, lines 10-11 */
  145.  
  146. SYSTEM_SPACE_LIMIT = WORD(lynes.12,1)
  147. maxidle            = WORD(lynes.13,1)
  148. maxtime            = WORD(lynes.14,1)
  149. maxbps             = WORD(lynes.15,1)
  150. IF ~DATATYPE(maxbps,'N') THEN maxbps=2400
  151. DO i=16 TO 30
  152.   j=i-15
  153.   bbsprefs.j=STRIP(WORD(lynes.i,1))
  154. END
  155. IF bbsprefs.10 THEN scratch=bbspath'Scratch'
  156. ELSE scratch='RAM:Scratch'
  157. CALL MAKEDIR(scratch)
  158.  
  159. SAY 'The ARexx portions of this software are copyright 1990 Richard Lee Stockton'CR
  160.  
  161. /** open log file */
  162. logfile = bbspath'Logs/log.'DATE('S')    /* daily logs */
  163. IF ~OPEN('log',logfile,'A') THEN
  164.   DO
  165.     IF ~OPEN('log',logfile,'W') THEN
  166.       DO
  167.         MSG 'failed to open log file'
  168.         SIGNAL DONE2
  169.      END
  170.   END
  171.  
  172. /* open printer? */
  173. IF bbsprefs.3 THEN
  174.   DO
  175.     IF ~OPEN(p,'PRT:','W') THEN
  176.       DO
  177.         CALL WRITELN('log','failed to open printer.')
  178.         bbsprefs.3=0
  179.       END
  180.   END
  181.  
  182. /*--------------- LOGIN -----------------------------------------*/
  183.  
  184. Remote ON
  185. CALL colors(1)
  186. Timeout 120
  187. CALL checkdcd();
  188.  
  189. msg.=''
  190. IF readopen(bbspath'Lists/Conferences') THEN
  191.   DO
  192.     DO i=1
  193.       line=READLN(f)
  194.       IF line='END' THEN BREAK;
  195.       IF EOF(f) THEN BREAK;
  196.       num=WORD(line,1)
  197.       IF DATATYPE(num,'N') THEN msg.num=WORD(line,2)
  198.     END
  199.     CALL CLOSE(f)
  200.   END
  201.  
  202. excuses.=''
  203.  
  204. SAY '        - FREELY DISTRIBUTABLE as long as this notice remains -'CR
  205. SAY CR
  206. SAY CR
  207. SAY 'Setting up, please wait...'CR
  208. SAY CR
  209.  
  210. files.=''
  211. IF readopen(bbspath'Lists/Files') THEN
  212.   DO
  213.     DO i=1
  214.       line=READLN(f)
  215.       IF EOF(f) THEN BREAK;
  216.       num=WORD(line,1)
  217.       line=DELWORD(line,1,1)
  218.       IF DATATYPE(num,'N') THEN files.num=line
  219.     END
  220.     files.0=i-1
  221.     CALL CLOSE(f)
  222.   END
  223.  
  224. courtesy=''
  225. IF EXISTS(bbspath'Lists/Courtesy') THEN
  226.   DO
  227.     IF readopen(bbspath'Lists/Courtesy') THEN
  228.       DO
  229.         DO i=1
  230.           line=READLN(f)
  231.           IF EOF(f) THEN BREAK;
  232.           courtesy=courtesy line
  233.         END
  234.         CALL CLOSE(f)
  235.       END
  236.   END
  237.  
  238. dirs.=''
  239. IF readopen(bbspath'Lists/Libraries') THEN
  240.   DO
  241.     DO i=1
  242.       line=READLN(f)
  243.       IF line='END' | EOF(f) THEN LEAVE i
  244.       num=WORD(line,1)
  245.       IF DATATYPE(num,'N') THEN dirs.num=STRIP(WORD(line,2))
  246.     END
  247.     CALL CLOSE(f)
  248.   END
  249.  
  250. CALL checkdcd()
  251. CALL loaduserlist();
  252.  
  253.  
  254. /** Identify (title) message */
  255. IF EXISTS(bbspath'BBS_TEXT/HELLO') THEN
  256.   DO
  257.     SAY CR
  258.     SAY CR
  259.     SAY CR
  260.     arg=bbspath'BBS_TEXT/HELLO'
  261.     CALL readlines(arg 1)
  262.     CALL seelines();
  263.   END
  264. SAY CR
  265.  
  266. Status Vers
  267. SAY 'Running on' Result 'at' bps 'baud.'CR
  268. SAY CR
  269. Stat 'Z'
  270. CALL checkdcd();
  271. MSG pen3'Courtesy List:'def
  272. MSG courtesy
  273.  
  274. /** Ask for name */
  275. name=''
  276. DO count=1 TO 3
  277.   name=getinput(1 0 'Please enter name: ')
  278.   name=SPACE(name,1,'_')
  279.   IF name='NEW' THEN LEAVE count;
  280.   IF name~='' THEN
  281.     DO
  282.       IF FIND(userlist,name)>0 THEN LEAVE count
  283.       IF FIND(exclusionlist,name)>0 THEN
  284.         DO
  285.           SAY 'Sorry, that is a reserved name.'CR
  286.           name=''
  287.         END
  288.       IF bbsprefs.7 | FIND(courtesy,name)>0 THEN
  289.         DO
  290.           SAY CR
  291.           SAY 'Welcome' name'!'CR
  292.           SAY 'You will be automatically validated after you enter your user info.'CR
  293.           SAY CR
  294.           LEAVE count
  295.         END
  296.     END
  297.   IF count<3 THEN SAY 'New Users please enter NEW to apply for validation.'CR
  298. END
  299. IF count>3 THEN SIGNAL DONE
  300. line=left(name,16,' ') 'logged in  at' time('C') date('W') date()
  301. CALL send2log(line);
  302. CALL checkUser()
  303. prevcaller=''
  304. prevcaller=GETCLIP('BBS_lastcaller')
  305. IF prevcaller~='' THEN CALL SETCLIP('BBS_prevcaller',prevcaller)
  306. city=TRANSLATE(data.3,'     ','+-.*/')
  307. DO i=WORDS(city) TO 1 BY -1
  308.   IF DATATYPE(WORD(city,i),'N') THEN city=STRIP(DELWORD(city,i,1))
  309.   IF UPPER(WORD(city,i))='USA' THEN city=STRIP(DELWORD(city,i,1))
  310. END
  311. city=SPACE(city,1)
  312. CALL SETCLIP('BBS_lastcaller',name city'  'TIME('C') DATE())
  313. CALL SETCLIP('BBS_level',level)
  314. Beep 700
  315. CALL DELAY(14)
  316. Beep
  317. CALL postuser(0);
  318.  
  319.  
  320. Timeout maxidle         /* max idle time at prompts */
  321.  
  322. /** Opening Display after logon. Seen by all Users ONCE A DAY. It first  **/
  323. /** looks for a unique yearly data (ie, WELCOME.0704), then daily data   **/
  324. /** (ie, WELCOME.Fri), and finally a simple, everyday 'WELCOME' datafile **/
  325.  
  326. IF DATE('I')>lastondate THEN
  327.   DO
  328.     arg=bbspath'BBS_TEXT/WELCOME.'RIGHT(DATE('S'),4)
  329.     IF ~EXISTS(arg) THEN
  330.       DO
  331.         arg=bbspath'BBS_TEXT/WELCOME.'LEFT(DATE('W'),3)
  332.         IF ~EXISTS(arg) THEN arg=bbspath'BBS_TEXT/WELCOME'
  333.       END
  334.     IF EXISTS(arg) THEN
  335.       DO
  336.         SAY CR
  337.         CALL showtext(arg)
  338.         nonstop=0
  339.       END
  340.   END
  341. SAY CR
  342.  
  343. /** Save old data directory */
  344. Status DataDir
  345. startdir=result
  346.  
  347. IF bbsprefs.1 THEN
  348.   DO
  349.     CALL doGrin();
  350.     CALL Moon.rexx();
  351.     CALL Time.rexx();
  352.     SAY CR
  353.   END
  354. CALL sortlibraries();
  355.  
  356. /* Get current protocol */
  357. Status Trans
  358. protocol = RESULT
  359. CALL TIME('R')
  360.  
  361. CALL logonstats();
  362. CALL newinfo(1);
  363. logonflag=0
  364. CALL readmail(0)
  365. IF level<99 & level>sysoplevel THEN
  366.   DO
  367.     SAY CR
  368.     CALL showtext(bbspath'Email/'sysop'/NEW_FILES')
  369.     SAY CR
  370.     CALL showtext(bbspath'Email/'sysop'/NEW_USERS')
  371.   END
  372. CALL showmarked()
  373. CALL setdir(libpath||dirs.1)
  374.  
  375.  
  376. /*-------------------------- MAIN ---------------------------------------*/
  377.  
  378. IF menu~='ALL' THEN menu='MAIN'
  379.  
  380. RESTART:
  381. waitchar=''
  382. string=''
  383. IF level<1 THEN menu='NEW'
  384. DO WHILE(opt~='G')
  385.   go=0
  386.   DO WHILE(~go)
  387.     IF waitchar='' | waitchar='?' THEN
  388.       DO
  389.         commands='cghiqswxyz!#'
  390.         IF level>0  THEN commands='bcdefghijlmnoprstuvwxyz!$#.'
  391.         IF level>sysoplevel THEN commands=commands'k%^()='
  392.         IF level=99 THEN commands=commands'@&-'
  393.         commands=commands'?'
  394.         IF menuflag | waitchar='?' | string='?' THEN
  395.           DO
  396.             opt='MENU'
  397.             arg=''
  398.             CALL postuser(1);
  399.             CALL menus();
  400.           END
  401.         ELSE SAY pen3'COMMANDS:'def commands||CR
  402.       END
  403.     mins=(maxtime-TIME('E'))%60
  404.     secs=TRUNC((maxtime-TIME('E'))//60)
  405.     IF secs<10 THEN secs='0'secs
  406.     SAY 'Time Remaining: ' mins':'secs||CR
  407.     CALL checktime();
  408.     line=''
  409.     line=line||bak2' 'TIME('C')' 'def
  410.     IF menu='ALL' | menu='FILE' THEN
  411.       line=line pen3'FILE_LIBRARY:'plaindir||def
  412.     ELSE IF menu='MSG' THEN line=line pen3'MESSAGES:'def
  413.     ELSE line=line pen3'MAIN:'def
  414.     OPTIONS PROMPT line' > '
  415.     IF waitchar='' THEN PARSE PULL string' 'arg .
  416.     ELSE PARSE VAR waitchar string' 'arg .
  417.     CALL checkdcd();
  418.     string=UPPER(STRIP(string))
  419.     IF string='OFF' | string='BYE' THEN SIGNAL LOGOUT;
  420.     waitchar=''
  421.     warnings=0
  422.     IF DATATYPE(string,'N') THEN
  423.       DO
  424.         dirnum=string
  425.         CALL chdir2();
  426.         CALL since();
  427.       END
  428.     opt=left(string,1)
  429.     IF opt='G' THEN
  430.       DO
  431.         IF getinput(1 1 pen3'Logoff? (nY) > 'def)='N' THEN opt='?'
  432.       END
  433.     go=1    /* check for access */
  434.     IF POS(opt,UPPER(commands))=0 & opt~='\' THEN go=0
  435.   END
  436.   CALL postuser(1);
  437.   OPTIONS PROMPT 'Filename: '
  438.   SELECT
  439.     WHEN(opt='B') THEN CALL browse();
  440.     WHEN(opt='C') THEN CALL editor('MAIL' sysop);
  441.     WHEN(opt='D') THEN CALL dload();
  442.     WHEN(opt='E') THEN CALL readmail(1);
  443.     WHEN(opt='F') THEN IF menu~='ALL' THEN menu='FILE'
  444.     WHEN(opt='H') THEN CALL help('MAIN');
  445.     WHEN(opt='I') THEN CALL information();
  446.     WHEN(opt='J') THEN CALL jump2rexx();
  447.     WHEN(opt='K') THEN CALL killuser();
  448.     WHEN(opt='L') THEN CALL list();
  449.     WHEN(opt='M') THEN IF menu~='ALL' THEN menu='MSG'
  450.     WHEN(opt='N') THEN CALL newfiles();
  451.     WHEN(opt='O') THEN CALL otheruser();
  452.     WHEN(opt='P') THEN CALL editor('MSG')
  453.     WHEN(opt='R') THEN CALL readmessages();
  454.     WHEN(opt='S') THEN CALL bbsSEARCH();
  455.     WHEN(opt='T') THEN CALL chpro();
  456.     WHEN(opt='U') THEN CALL uload(1);
  457.     WHEN(opt='V') THEN CALL viewtext();
  458.     WHEN(opt='W') THEN CALL showuserlist()
  459.     WHEN(opt='X') THEN CALL switchmenuflag();
  460.     WHEN(opt='Y') THEN CALL edituser();
  461.     WHEN(opt='Z') THEN CALL counts();
  462.     WHEN(opt='\') THEN CALL chat();
  463.     WHEN(opt='!') THEN CALL yell();
  464.     WHEN(opt='@') THEN CALL shell();
  465.     WHEN(opt='#') THEN CALL switchcolors();
  466.     WHEN(opt='$') THEN IF menu='ALL' THEN menu='MAIN'; ELSE menu='ALL'
  467.     WHEN(opt='%') THEN CALL editnote();
  468.     WHEN(opt='^') THEN CALL readlogs();
  469.     WHEN(opt='&') THEN CALL sysED(1);
  470.     WHEN(opt='-') THEN CALL edfilenote();
  471.     WHEN(opt='(') THEN CALL filereport();
  472.     WHEN(opt=')') THEN CALL mailreport();
  473.     WHEN(opt='=') THEN CALL levelreport();
  474.     WHEN(opt='.') THEN IF menu~='ALL' THEN menu='MAIN'
  475.     WHEN(opt='?') & menuflag THEN CALL help('MAIN');
  476.     OTHERWISE NOP
  477.   END
  478. END
  479. SIGNAL LOGOUT
  480. EXIT;       /* an extra margin of safety */
  481.  
  482.  
  483. /*------------------------- FUNCTIONS ----------------------------------*/
  484.  
  485. showtext:
  486. PARSE ARG arg .
  487. IF EXISTS(arg) THEN
  488.   DO
  489.     CALL readlines(arg 1);
  490.     CALL seelines();
  491.     nonstop=0
  492.     CALL waiting();
  493.   END
  494. RETURN;
  495.  
  496.  
  497. doGrin:
  498. CALL setdir(bbspath'rexxDoors')
  499. CALL Grin_du_Jour.rexx();
  500. SAY CR
  501. RETURN;
  502.  
  503.  
  504. send2log:
  505. PARSE ARG sendline
  506. CALL WRITELN('log',sendline)
  507. IF bbsprefs.3 THEN CALL WRITELN(p,sendline)
  508. RETURN;
  509.  
  510.  
  511. killuser:
  512. IF level<=sysoplevel THEN RETURN;
  513. IF arg='' THEN
  514.   DO
  515.     OPTIONS PROMPT 'Username: '
  516.     PARSE PULL arg .
  517.   END
  518. IF STRIP(arg)='' THEN RETURN;
  519. arg=UPPER(arg)
  520. arg=SPACE(STRIP(arg),1,'_')
  521. IF getinput(1 1 'Really kill' arg'? (nY) > ')='N' THEN RETURN;
  522. SAY 'Working...'lineup||CR
  523. IF readlines(bbspath'Users/'arg 1) THEN SAY 'User not found.'CR
  524. IF level<=lynes.20 THEN
  525.   DO
  526.     SAY '*** Tsk! Tsk!  Your level is not greater than' arg'.'CR
  527.     CALL send2log('Tried to kill:' arg)
  528.     RETURN;
  529.   END
  530. CALL DELETE(bbspath'Users/'arg)
  531. IF EXISTS(bbspath'Email/'arg) THEN
  532.   ADDRESS COMMAND 'DELETE >*' bbspath'Email/'arg 'ALL'
  533. IF EXISTS(bbspath'EmailFiles/'arg) THEN
  534.   ADDRESS COMMAND 'DELETE >*' bbspath'EmailFiles/'arg 'ALL'
  535. CALL DELETE(bbspath'Lists/USERS')
  536. CALL loaduserlist();
  537. CALL send2log('Killed:' arg)
  538. SAY 'User file, Email & EmailFiles for' arg 'have been deleted.'CR
  539. RETURN;
  540.  
  541.  
  542. menus:
  543. SAY CR
  544. IF menu='NEW' THEN
  545. DO
  546.   SAY pen6'     _________________'def||CR
  547.   SAY pen6'  __/  'pen3'New User Menu'pen6'  \___'def||CR
  548.   SAY pen6' |                        |'def||CR
  549.   SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def||CR
  550.   SAY pen6' |'def'   ['pen3'I'def']nfomation         'pen6'|'def||CR
  551.   SAY pen6' |'def'   ['pen3'Y'def']our user data     'pen6'|'def||CR
  552.   SAY pen6' |'def'   ['pen3'W'def']ho is here        'pen6'|'def||CR
  553.   SAY pen6' |'def'   ['pen3'S'def']earch user list   'pen6'|'def||CR
  554.   SAY pen6' |'def'   ['pen3'Z'def'] bbs statistics   'pen6'|'def||CR
  555.   SAY pen6' |'def'   ['pen3'X'def'] toggle menus     'pen6'|'def||CR
  556.   SAY pen6' |'def'   ['pen3'#'def'] toggle color     'pen6'|'def||CR
  557.   SAY pen6' |'def'   ['pen3'!'def'] YELL for SYSOP   'pen6'|'def||CR
  558.   SAY pen6' |'def'   ['pen3'C'def']omment to SYSOP   'pen6'|'def||CR
  559.   SAY pen6' |'def'   ['pen3'G'def']oodbye (hangup)   'pen6'|'def||CR
  560.   MSG pen6' |'def'   ['pen3'\'def'] Chat             'pen6'|'def
  561.   SAY pen6' |________________________|'def||CR
  562. END
  563. ELSE IF menu='MSG' THEN
  564. DO
  565.     SAY pen6'       ____________'def||CR
  566.     SAY pen6'  ____/  'pen3'Messages'pen6'  \_____'def||CR
  567.     SAY pen6' |                       |'def||CR
  568.     SAY pen6' |'def'   ['pen3'H'def']elp              'pen6'|'def||CR
  569.     SAY pen6' |'def'   ['pen3'P'def']ost messages     'pen6'|'def||CR
  570.     SAY pen6' |'def'   ['pen3'R'def']ead messages     'pen6'|'def||CR
  571.     SAY pen6' |'def'   ['pen3'S'def']earch messages   'pen6'|'def||CR
  572.     SAY pen6' |'def'   ['pen3'E'def']mail (private)   'pen6'|'def||CR
  573.     SAY pen6' |'def'   ['pen3'C'def']omment to SYSOP  'pen6'|'def||CR
  574.     SAY pen6' |'def'   ['pen3'!'def'] YELL for SYSOP  'pen6'|'def||CR
  575.     MSG pen6' |'def'   ['pen3'\'def'] Chat            'pen6'|'def
  576. IF(level>sysoplevel) THEN DO
  577.     SAY pen6' |'def'   ['pen3'^'def'] view BBS logs   'pen6'|'def||CR
  578.     SAY pen6' |'def'   ['pen3')'def'] email report    'pen6'|'def||CR
  579.     SAY pen6' |'def'   ['pen3'='def'] level report    'pen6'|'def||CR;END
  580. IF(level=99) THEN DO;
  581.     SAY pen6' |'def'   ['pen3'&'def'] online editor   'pen6'|'def||CR
  582.     SAY pen6' |'def'   ['pen3'@'def'] dos shell       'pen6'|'def||CR;END
  583.     SAY pen6' |'def'   ['pen3'F'def']iles menu        'pen6'|'def||CR
  584.     SAY pen6' |'def'   ['pen3'.'def'] main menu       'pen6'|'def||CR
  585.     SAY pen6' |_______________________|'def||CR
  586. END
  587. ELSE IF menu='FILE' THEN
  588. DO
  589.     SAY pen6'         _________'def||CR
  590.     SAY pen6'  ______/  'pen3'Files'pen6'  \_______'def||CR
  591.     SAY pen6' |                        |'def||CR
  592.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def||CR
  593.     SAY pen6' |'def'   ['pen3'B'def']rowse filenotes   'pen6'|'def||CR
  594.     SAY pen6' |'def'   ['pen3'N'def']ew files list     'pen6'|'def||CR
  595.     SAY pen6' |'def'   ['pen3'L'def']ist files         'pen6'|'def||CR
  596.     SAY pen6' |'def'   ['pen3'S'def']earch files       'pen6'|'def||CR
  597.     SAY pen6' |'def'   ['pen3'V'def']iew textfile      'pen6'|'def||CR
  598.     SAY pen6' |'def'   ['pen3'U'def']pload             'pen6'|'def||CR
  599.     SAY pen6' |'def'   ['pen3'D'def']ownload           'pen6'|'def||CR
  600.     SAY pen6' |'def'   ['pen3'T'def']ransfer protocol  'pen6'|'def||CR
  601. IF(level>sysoplevel) THEN DO
  602.     SAY pen6' |'def'   ['pen3'K'def']ill a user        'pen6'|'def||CR
  603.     SAY pen6' |'def'   ['pen3'%'def'] edit filenote    'pen6'|'def||CR
  604.     SAY pen6' |'def'   ['pen3'('def'] file report      'pen6'|'def||CR;END
  605. IF(level=99) THEN DO;
  606.     SAY pen6' |'def'   ['pen3'-'def'] edit filecomment 'pen6'|'def||CR
  607.     SAY pen6' |'def'   ['pen3'@'def'] dos shell        'pen6'|'def||CR;END
  608.     MSG pen6' |'def'   ['pen3'\'def'] Chat             'pen6'|'def
  609.     SAY pen6' |'def'   ['pen3'M'def']essages menu      'pen6'|'def||CR
  610.     SAY pen6' |'def'   ['pen3'.'def'] main menu        'pen6'|'def||CR
  611.     SAY pen6' |________________________|'def||CR
  612. END
  613. ELSE IF menu='MAIN' THEN
  614. DO
  615.     SAY pen6'       _____________'def||CR
  616.     SAY pen6'  ____/  'pen3'Main Menu'pen6'  \_____'def||CR
  617.     SAY pen6' |                        |'def||CR
  618.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def||CR
  619.     SAY pen6' |'def'   ['pen3'I'def']nfomation         'pen6'|'def||CR
  620.     SAY pen6' |'def'   ['pen3'J'def']ump to doorways   'pen6'|'def||CR
  621.     SAY pen6' |'def'   ['pen3'Y'def']our user data     'pen6'|'def||CR
  622.     SAY pen6' |'def'   ['pen3'W'def']ho is here list   'pen6'|'def||CR
  623.     SAY pen6' |'def'   ['pen3'S'def']earch userlist    'pen6'|'def||CR
  624.     SAY pen6' |'def'   ['pen3'O'def']ther users info   'pen6'|'def||CR
  625.     SAY pen6' |'def'   ['pen3'X'def']pert (no menus)   'pen6'|'def||CR
  626.     SAY pen6' |'def'   ['pen3'#'def'] toggle colors    'pen6'|'def||CR
  627.     SAY pen6' |'def'   ['pen3'$'def'] toggle menu(s)   'pen6'|'def||CR
  628.     SAY pen6' |'def'   ['pen3'Z'def'] bbs statistics   'pen6'|'def||CR
  629.     SAY pen6' |'def'   ['pen3'G'def']oodbye (hangup)   'pen6'|'def||CR
  630.     MSG pen6' |'def'   ['pen3'\'def'] Chat             'pen6'|'def
  631.     SAY pen6' |'def'   ['pen3'F'def']iles menu         'pen6'|'def||CR
  632.     SAY pen6' |'def'   ['pen3'M'def']essages menu      'pen6'|'def||CR
  633.     SAY pen6' |________________________|'def||CR
  634. END
  635. ELSE IF menu='ALL' THEN
  636. DO
  637.     SAY pen6'     __________________________________________________________'def||CR
  638.     SAY pen6'  __/   'pen3'Main Menu            File Menu          Message Menu 'pen6'  \__'def||CR
  639.     SAY pen6' |                                                                |'def||CR
  640.     SAY pen6' |'def' ['pen3'H'def']elp               ['pen3'B'def']rowse filenotes   ['pen3'P'def']ost messages      'pen6'|'def||CR
  641.     SAY pen6' |'def' ['pen3'I'def']nfomation         ['pen3'N'def']ew files list     ['pen3'R'def']ead messages      'pen6'|'def||CR
  642.     SAY pen6' |'def' ['pen3'W'def']ho is here list   ['pen3'L'def']ist files by Lib  ['pen3'E'def']mail (private)    'pen6'|'def||CR
  643.     SAY pen6' |'def' ['pen3'Y'def']our user data     ['pen3'U'def']pload             ['pen3'C'def']omment to SYSOP   'pen6'|'def||CR
  644.     SAY pen6' |'def' ['pen3'O'def']ther users info   ['pen3'D'def']ownload           ['pen3'!'def'] YELL for SYSOP   'pen6'|'def||CR
  645.     SAY pen6' |'def' ['pen3'J'def']ump to doorways   ['pen3'V'def']iew textfile      ['pen3'X'def']pert (no menus)   'pen6'|'def||CR
  646.     SAY pen6' |'def' ['pen3'S'def']earch menu        ['pen3'T'def']ransfer protocol  ['pen3'$'def'] toggle menu(s)   'pen6'|'def||CR
  647.     SAY pen6' |'def' ['pen3'G'def']oodbye (logoff)   ['pen3'Z'def'] bbs statiZtics   ['pen3'#'def'] toggle colors    'pen6'|'def||CR
  648. IF(level>sysoplevel) THEN DO
  649.     SAY pen6' |'def' ['pen3'K'def']ill a user        ['pen3'%'def'] edit filenote    ['pen3'='def'] level report     'pen6'|'def||CR
  650.     SAY pen6' |'def' ['pen3'^'def'] view BBS logs    ['pen3'('def'] file report      ['pen3')'def'] email report     'pen6'|'def||CR;END
  651. IF(level=99) THEN
  652.     SAY pen6' |'def' ['pen3'@'def'] dos shell        ['pen3'-'def'] edit filecomment ['pen3'&'def'] online editor    'pen6'|'def||CR
  653.     MSG pen6' |'def'                                           ['pen3'\'def'] Chat             'pen6'|'def
  654.     SAY pen6' |________________________________________________________________|'def||CR
  655. END
  656. SAY CR
  657. RETURN;
  658.  
  659.  
  660. help:
  661. ARG helppath .
  662. SAY CR
  663. SAY 'For more detailed help, use the ['pen3'I'def']nformation commmand to read HELP.'CR
  664. IF helppath='MAIN' THEN
  665.   SAY 'Commands available from the' pen3||menu||def 'menu:'CR
  666. frontend=bbspath'BBS_HELP/'helppath
  667. backend='.USER'
  668. IF level=0 THEN backend='.NEW'
  669. ELSE IF level=99 THEN backend='.SUPER'
  670. ELSE IF level>sysoplevel THEN backend='.SYSOP'
  671. CALL showtext(frontend||backend);
  672. RETURN;
  673.  
  674.  
  675. waiting:
  676. CALL checktime();
  677. waitchar=''
  678. IF nonstop=1 THEN RETURN;
  679. OPTIONS PROMPT pen3'                       RETURN=Continue 'def
  680. PULL waitchar
  681. CALL cleanline(1);
  682. CALL checkdcd();
  683. RETURN;
  684.  
  685.  
  686. cleanline:
  687. ARG lflag .
  688. cline=lineup||LEFT(' ',78)
  689. IF lflag=1 THEN cline=cline||lineup
  690. SAY cline||CR
  691. RETURN;
  692.  
  693.  
  694. getinput:
  695. PARSE ARG upflag' 'oneflag' 'pline
  696. OPTIONS PROMPT pline
  697. PARSE PULL inarg
  698. inarg=STRIP(inarg)
  699. IF upflag THEN inarg=UPPER(inarg)
  700. IF oneflag THEN inarg=LEFT(inarg,1)
  701. CALL checkdcd();
  702. RETURN(inarg);
  703.  
  704.  
  705. postuser:
  706. IF bbsprefs.12~=1 THEN RETURN;
  707. ARG upflag .
  708. line2=''
  709. IF upflag=6 THEN line2=line2||CENTER('Logoff:' DATE() TIME('C')'  'name city,74)
  710. ELSE line2=line2||CENTER(name city'  Last On:' DATE(,lastondate,'I'),74)
  711. line2=line2'\'
  712. line2=line2||CENTER('Baud:' bps'   Usage:' data.19,74)'\'
  713. ulb=WORD(data.14,3)
  714. IF ~DATATYPE(ulb,'N') THEN ulb=1
  715. dlb=WORD(data.15,3)
  716. IF ~DATATYPE(dlb,'N') THEN dlb=0
  717. dlup=TRUNC(dlb/ulb+.005,2)
  718. line3='Level: 'level'   dl/ul:' dlup
  719. IF upflag=0 THEN line2=line2||CENTER(line3,74)
  720. IF upflag=1 THEN line2=line2||CENTER(line3'   Cmd:' opt arg,74)
  721. IF upflag=2 THEN line2=line2||CENTER(line3'   MSG:' msg.msgdir,74)
  722. IF upflag=3 THEN line2=line2||CENTER(line3'   Email',74)
  723. IF upflag=4 THEN line2=line2||CENTER(line3'   ul:' arg,74)
  724. IF upflag=5 THEN line2=line2||CENTER(line3'   dl:' arg,74)
  725. IF upflag=6 THEN
  726.   DO
  727.     line3=line3'   Elapsed:'elapsed' '
  728.     IF EXISTS(bbspath'Email/'sysop'/NEW_FILES') THEN line3=line3 'NEW_FILES'
  729.     IF EXISTS(bbspath'Email/'sysop'/NEW_USERS') THEN line3=line3 'NEW_USERS'
  730.     line2=line2||CENTER(line3,74)
  731.   END
  732. CALL PostMsg(3,14,line2)
  733. RETURN;
  734.  
  735.  
  736. whodat:
  737. MSG RIGHT(' ',66-LENGTH(name)) pen0||bak1' 'name' level 'level' 'def||CR||lineup
  738. RETURN;
  739.  
  740.  
  741. checktime:
  742. IF TIME('E')>maxtime THEN
  743.   DO
  744.     SAY 'Sorry,' name 'your time has expired.'CR
  745.     CALL send2log('*** Time Expired ***');
  746.     CALL OUT
  747.   END
  748. IF TIME('E')>(maxtime-120) THEN SAY '*** Less than 2 minutes left! ***'CR
  749. CALL whodat();
  750. CALL checkdcd();
  751. RETURN;
  752.  
  753.  
  754. setdir:
  755. PARSE ARG tempdir
  756. CALL PRAGMA('D',STRIP(tempdir))
  757. directory=PRAGMA('D')
  758. Data directory
  759. slash=LASTPOS('/',directory)
  760. IF slash=0 THEN slash=LASTPOS(':',directory)
  761. plaindir=directory
  762. IF slash>0 THEN plaindir=SUBSTR(plaindir,slash+1)
  763. RETURN;
  764.  
  765.  
  766. readlogs:
  767. IF arg='' THEN
  768.   arg=getinput(1 0 '['pen3'RETURN'def']=TODAY, or enter Log Date ('pen3||DATE('S')||def') > ');
  769. IF arg='' THEN arg=DATE('S')
  770. arg=bbspath'Logs/log.'arg
  771. CALL readlines(arg 1);
  772. CALL seelines();
  773. nonstop=0
  774. CALL waiting();
  775. RETURN;
  776.  
  777.  
  778. otheruser:
  779. SAY CR
  780. SAY 'To allow (or not) other users to see your street address and/or phone number,'CR
  781. SAY 'add (or delete) STREET and/or PHONE to the line 8 list in ['pen3'Y'def']our userfile.'CR
  782. SAY CR
  783. SAY 'User specification may include ? wildcard for single characters. 'CR
  784. SAY 'ie,' pen3's?n'def 'will return all user names containing ''son'', ''sen'', ''sin'', etc.'CR
  785. IF arg='' THEN arg=getinput(1 0 pen3'User specification: 'def)
  786. IF arg='' THEN RETURN;
  787. arg=TRANSLATE(STRIP(arg),'_',' ')
  788. CALL FileList(bbspath'Users/*'arg'*',wildlist)
  789. line='Found' wildlist.0 'match'
  790. IF wildlist.0~=1 THEN line=line'es'
  791. SAY line'.'CR
  792. IF wildlist.0<1 THEN RETURN;
  793. totlines=0
  794. nextpagebreak=linesperpage-3
  795. extrainfo=0
  796. IF level>sysoplevel THEN
  797.   DO
  798.     IF getinput(1 1 'Display -sysop only- information? (nY) > ')~='N' THEN
  799.       extrainfo=1
  800.   END
  801. DO i=1 TO wildlist.0
  802.   CALL readlines(wildlist.i 1)
  803.   SAY CR
  804.   totlines=totlines+4
  805.   SAY lynes.1||CR
  806.   IF FIND(UPPER(lynes.8),'STREET')>0 THEN
  807.     DO
  808.       totlines=totlines+1
  809.       SAY lynes.2||CR
  810.     END
  811.   SAY lynes.3||CR
  812.   IF FIND(UPPER(lynes.8),'PHONE')>0 THEN
  813.     DO
  814.       totlines=totlines+1
  815.       SAY lynes.4||CR
  816.     END
  817.   SAY 'Last time on' bbsname':' DATE(,WORD(lynes.13,1),'S') WORD(lynes.13,2)||CR
  818.   SAY pen3'Interests:'def lynes.10||CR
  819.   IF extrainfo THEN
  820.     DO
  821.       SAY pen3'   up:'def lynes.14||CR
  822.       SAY pen3' down:'def lynes.15||CR
  823.       temptot=0
  824.       DO j=1 TO WORDS(lynes.23)
  825.         IF DATATYPE(WORD(lynes.23,j),'N') THEN temptot=temptot+WORD(lynes.23,j)
  826.       END
  827.       SAY pen3' writ:'def temptot 'public messages.'CR
  828.       SAY pen3'level:'def lynes.20||CR
  829.       totlines=totlines+4
  830.       IF lynes.21~='' THEN
  831.         DO
  832.           totlines=totlines+1
  833.           SAY pen3'excluded dirs:'def lynes.21||CR
  834.         END
  835.     END
  836.   IF totlines>=nextpagebreak THEN
  837.     DO
  838.       CALL waiting();
  839.       nextpagebreak=totlines+linesperpage-3
  840.     END
  841. END
  842. CALL waiting();
  843. RETURN;
  844.  
  845.  
  846. levelreport:
  847. DO i=1 TO WORDS(userlist)
  848.   arg=bbspath'Users/'WORD(userlist,i)
  849.   CALL readlines(arg 1)
  850.   line=lynes.20 WORD(userlist,i)
  851.   SAY line||CR
  852.   IF ~DATATYPE(WORD(lynes.20,1),'N') | WORD(lynes.20,1)=0 THEN
  853.     DO
  854.       temp=getinput(1 1 '[A]dd or [K]ill this user? (kA) > ');
  855.       IF temp='K' THEN
  856.         DO
  857.           arg=WORD(userlist,i)
  858.           CALL killuser();
  859.           CALL cleanline();
  860.         END
  861.       ELSE
  862.         DO
  863.           IF readopen(bbspath'BBS_TEXT/DEF.MEMBER') THEN
  864.             DO
  865.               DO lvi=1 TO 21
  866.                 line=READLN(f)
  867.                 IF lvi=11 THEN lynes.11=line
  868.                 IF lvi=20 THEN lynes.20=line
  869.               END
  870.               lynes.21=line
  871.               CALL CLOSE(f)
  872.               edtype=''
  873.               CALL savelines(arg);
  874.             END
  875.           ELSE SAY 'You need a default member file in BBS_TEXT!   ( BBS_TEXT/DEF.MEMBER )'CR
  876.         END
  877.     END
  878.   IF i//linesperpage=0 THEN CALL waiting();
  879. END
  880. RETURN;
  881.  
  882.  
  883. filereport:
  884. IF getinput(1 1 'Check against filelist? (yN) > ')='Y' THEN dokk=1
  885. ELSE dokk=0
  886. SAY 'Searching for mismatches between files and filenotes...'CR
  887. kk=countcheck(bbspath'Numbers/LastFile')
  888. DO i=1 TO sysoplevel+1
  889.   IF dirs.i='' THEN ITERATE
  890.   SAY dirs.i'                               'lineup||CR
  891.   rfiles=SHOWDIR(libpath||dirs.i)
  892.   rnotes=SHOWDIR(bbspath'FileNotes/'dirs.i)
  893.   IF WORDS(rfiles)~=WORDS(rnotes) THEN
  894.     DO
  895.       line='Compare files & filenotes in'pen3 dirs.i||def'. '
  896.       DO j=1 TO WORDS(rfiles)
  897.         IF FIND(UPPER(rnotes),UPPER(WORD(rfiles,j)))=0 THEN
  898.           line=line WORD(rfiles,j)
  899.       END
  900.       SAY line||CR
  901.     END
  902.   DO j=1 TO WORDS(rfiles) WHILE dokk
  903.     DO k=1 TO kk
  904.       IF files.k='' THEN ITERATE k
  905.       IF UPPER(WORD(rfiles,j))=UPPER(WORD(files.k,2)) THEN ITERATE j
  906.     END
  907.     SAY WORD(rfiles,j) 'is not on the filelist.'CR
  908.   END
  909. END
  910. Send '^G'
  911. CALL waiting();
  912. RETURN;
  913.  
  914.  
  915. mailreport:
  916. SAY 'Searching for ALL pending Email...'CR
  917. SAY pen3' - Use CTRL-E to Exit -'def||CR
  918. mailrep=SHOWDIR(bbspath'Email')
  919. mailfil=SHOWDIR(bbspath'EmailFiles')
  920. emailnum=0
  921. lastemail=WORD(data.17,3)
  922. IF ~DATATYPE(lastemail,'N') THEN lastemail=0
  923. mailynes.=''
  924. mk=0
  925. DO mi=1 TO WORDS(mailrep)
  926.   muser=WORD(mailrep,mi)
  927.   mlist=SHOWDIR(bbspath'Email/'muser)
  928.   DO mj=1 TO WORDS(mlist)
  929.     fuser=WORD(mlist,mj)
  930.     mk=mk+1
  931.     mailynes.mk=pen3||LEFT(muser,20) 'from'def LEFT(fuser,20) DATE(,WORD(STATEF(bbspath'Email/'muser'/'fuser),5),'I')
  932.     IF POS(sysop,fuser)=0 & POS(name,fuser)=0 THEN
  933.       DO
  934.         testnum=RIGHT(fuser,LENGTH(fuser)-LASTPOS('.',fuser))
  935.         IF testnum>emailnum THEN emailnum=testnum
  936.         IF testnum>lastemail THEN CALL showtext(bbspath'Email/'muser'/'fuser);
  937.       END
  938.   END
  939.   IF FIND(mailfil,muser)>0 THEN
  940.     DO
  941.       efilelist=SHOWDIR(bbspath'EmailFiles/'muser)
  942.       IF WORDS(efilelist)>0 THEN
  943.         DO
  944.           mk=mk+1
  945.           mailynes.mk=pen3||LEFT(muser,20) 'emailfiles'def efilelist
  946.         END
  947.     END
  948. END
  949. data.17=WORD(data.17,1) WORD(data.17,2) emailnum
  950. IF mk>0 THEN
  951.   DO
  952.     lynes.0=mk
  953.     DO mi=1 TO mk
  954.       lynes.mi=mailynes.mi
  955.     END
  956.     CALL seelines();
  957.     nonstop=0
  958.     CALL waiting();
  959.   END
  960. ELSE SAY 'No Email pending.'CR
  961. RETURN;
  962.  
  963.  
  964. jump2rexx:
  965. IF ~DATATYPE(jdoors.0,'N') THEN
  966.   DO
  967.     jdoors.=''
  968.     doorlist=SHOWDIR(bbspath'rexxDoors','F')
  969.     doors.=''
  970.     doors.0=WORDS(doorlist)
  971.     DO i=1 TO doors.0
  972.       doors.i=WORD(doorlist,i)
  973.     END
  974.     SAY 'Sorting..'lineup||CR
  975.     CALL QSORT(1,doors.0,doors)
  976.     jdoors.0=doors.0%3
  977.     IF (doors.0//3)>0 THEN jdoors.0=jdoors.0+1
  978.     DO i=1 TO jdoors.0
  979.       jdoors.i=LEFT(RIGHT(i,3)'.' LEFT(doors.i,LENGTH(doors.i)-5),24)
  980.       DO j=1 TO 2
  981.         k=i+j*jdoors.0
  982.         IF k<=doors.0 THEN
  983.           jdoors.i=jdoors.i' 'LEFT(RIGHT(k,3)'.' LEFT(doors.k,LENGTH(doors.k)-5),24)
  984.       END
  985.     END
  986.   END
  987. DO doorloop=1
  988.   SAY pen3||LEFT('-',75,'-')||def||CR
  989.   DO jd=1 TO jdoors.0
  990.     SAY jdoors.jd||CR
  991.     IF jd//linesperpage=0 THEN CALL waiting();
  992.     IF waitchar='Q' THEN RETURN;
  993.   END
  994.   temp=getinput(1 0 pen3'Select Application Number > 'def);
  995.   IF ~DATATYPE(temp,'N') | temp<1 | temp>doors.0 THEN RETURN;
  996.   curdir=PRAGMA('D')
  997.   CALL setdir(bbspath'rexxDoors');
  998.   CALL SETCLIP('BBS_winnings')
  999.   savewinnings=0
  1000.   IF UPPER(doors.temp)='ONE_ARMED_BANDIT.REXX' THEN
  1001.     IF getinput(1 1 'Play for this sessions time in seconds? (yN) > ')='Y' THEN
  1002.       DO
  1003.         savewinnings=winnings
  1004.         winnings=TRUNC(maxtime-TIME('E'))
  1005.         SAY 'Playing for REAL seconds, not wimpy play-dollars!'CR
  1006.       END
  1007.   INTERPRET 'call' doors.temp'('name winnings savewinnings')'
  1008.   testwin=GETCLIP('BBS_winnings')
  1009.   IF DATATYPE(testwin,'N') THEN
  1010.     DO
  1011.       IF testwin>7200 THEN
  1012.         DO
  1013.           SAY 'Although you won' TRUNC(testwin/60) 'minutes, the maximum session time is 120 minutes.'CR
  1014.           testwin=7200
  1015.         END
  1016.       winnings=testwin
  1017.       IF savewinnings>0 THEN
  1018.         DO
  1019.           maxtime=TRUNC(testwin+TIME('E'))
  1020.           winnings=savewinnings
  1021.         END
  1022.     END
  1023.   CALL setdir(curdir);
  1024.   CALL checktime();
  1025.   CALL SETCLIP('BBS_winnings')
  1026. END
  1027. RETURN;
  1028.  
  1029.  
  1030. sortlibraries:
  1031. SAY 'Sorting Libraries...'lineup||CR
  1032. count=0
  1033. sdirs.=''
  1034. DO i=1 TO level
  1035.   IF dirs.i='' THEN ITERATE i
  1036.   count=count+1
  1037.   sdirs.count=dirs.i i
  1038. END
  1039. sdirs.0=count
  1040. CALL QSort(1,count,sdirs);
  1041. count=0
  1042. libs.=''
  1043. DO i=1 TO sdirs.0
  1044.   tempnum=WORD(sdirs.i,2)
  1045.   tempdir=WORD(sdirs.i,1)
  1046.   IF FIND(UPPER(data.21),UPPER(tempdir))=0 THEN
  1047.     DO
  1048.       string=' '
  1049.       IF tempnum<10 THEN string=string' '
  1050.       string=string || tempnum'. 'LEFT(tempdir,14)
  1051.       count=count+1
  1052.       libs.count=string
  1053.     END
  1054. END
  1055. libs.0=count%4
  1056. IF (count//4)>0 THEN libs.0=libs.0+1
  1057. DO i=1 TO libs.0
  1058.   DO j=1 TO 3
  1059.     k=i+j*libs.0
  1060.     IF k<=count THEN libs.i=libs.i libs.k
  1061.   END
  1062. END
  1063. CALL sortconferences();
  1064. RETURN;
  1065.  
  1066.  
  1067. sortconferences:
  1068. SAY 'Sorting Conferences...'lineup||CR
  1069. count=0
  1070. smsg.=''
  1071. DO i=1 TO level
  1072.   IF msg.i='' THEN ITERATE i
  1073.   count=count+1
  1074.   smsg.count=msg.i i
  1075. END
  1076. smsg.0=count
  1077. CALL QSort(1,count,smsg);
  1078. count=0
  1079. msgs.=''
  1080. DO i=1 TO smsg.0
  1081.   tempnum=WORD(smsg.i,2)
  1082.   tempdir=WORD(smsg.i,1)
  1083.   IF FIND(UPPER(data.21),tempnum)=0 THEN
  1084.     DO
  1085.       string=' '
  1086.       IF tempnum<10 THEN string=string' '
  1087.       string=string || tempnum'.'
  1088.       IF WORD(data.22,tempnum)='' | WORD(data.22,tempnum)>=0 THEN
  1089.         string=string LEFT(tempdir,20)
  1090.       ELSE string=string pen3'-OFF-'def LEFT(tempdir,14)
  1091.       count=count+1
  1092.       msgs.count=string
  1093.     END
  1094. END
  1095. msgs.0=count%3
  1096. IF (count//3)>0 THEN msgs.0=msgs.0+1
  1097. DO i=1 TO msgs.0
  1098.   DO j=1 TO 2
  1099.     k=i+j*msgs.0
  1100.     IF k<=count THEN msgs.i=msgs.i msgs.k
  1101.   END
  1102. END
  1103. RETURN;
  1104.  
  1105.  
  1106. readmessages:
  1107. DO FOREVER
  1108.   SAY CR
  1109.   IF DATATYPE(arg,'N') THEN msgdir=arg
  1110.   ELSE IF LEFT(UPPER(arg),1)='A' THEN
  1111.     DO
  1112.       CALL newmsgs();
  1113.       RETURN;
  1114.     END
  1115.   ELSE
  1116.     DO
  1117.       SAY 'Select Message Conference By Number or ['pen3'A'def']ll Active'CR
  1118.       IF areaselect() THEN
  1119.         DO
  1120.           IF LEFT(temp,1)='A' THEN CALL newmsgs();
  1121.           waitchar=temp
  1122.           RETURN;
  1123.         END
  1124.     END
  1125.   junk=getinput(1 1 '['pen3'M'def']ask ON/OFF  ['pen3'R'def']ead  ['pen3'Q'def']uit (Rmq) > ')
  1126.   IF junk='Q' THEN RETURN;
  1127.   IF junk='M' THEN
  1128.     DO
  1129.       line='Turning the' msg.msgdir 'conference'
  1130.       IF WORD(data.22,msgdir)<0 THEN
  1131.         DO
  1132.           line=line pen3'ON'def'.'
  1133.           newdata='0'
  1134.         END
  1135.       ELSE
  1136.         DO
  1137.           line=line pen3'OFF'def'.'
  1138.           newdata='-1'
  1139.         END
  1140.       SAY line||CR
  1141.       dataloc=WORDINDEX(data.22,msgdir)-1
  1142.       data.22=DELWORD(data.22,msgdir,1)
  1143.       data.22=INSERT(newdata' ',data.22,dataloc)
  1144.       CALL sortconferences();
  1145.     END
  1146.   CALL readmsg(0);
  1147.   CALL saveData(1);
  1148.   nonstop=0
  1149.   arg=''
  1150. END
  1151. RETURN;
  1152.  
  1153.  
  1154. newmsgs:
  1155. curmsgdir=msgdir
  1156. SAY 'Scanning all Conferences for new messages..'CR
  1157. DO newi=1 TO level
  1158.   IF newi>level THEN LEAVE newi
  1159.   IF msg.newi='' THEN ITERATE newi
  1160.   msgdir=newi
  1161.   CALL readmsg(1);
  1162.   IF msgcom='Q' THEN LEAVE newi
  1163. END
  1164. CALL saveData(1);
  1165. msgdir=curmsgdir
  1166. nonstop=0
  1167. RETURN;
  1168.  
  1169.  
  1170. readmsg:
  1171. ARG quietflag
  1172. IF msg.msgdir='' | FIND(data.21,msgdir)>0 THEN RETURN;   /* sysop excluded */
  1173. IF WORD(data.22,msgdir)=-1 THEN RETURN;  /*  user excluded */
  1174. IF quietflag=0 THEN SAY 'Entering' msg.msgdir 'Message Conference..'CR
  1175. CALL postuser(2);
  1176. IF DATATYPE(WORD(data.22,msgdir),'N') THEN
  1177.   lastread.msgdir=WORD(data.22,msgdir)
  1178. ELSE lastread.msgdir=0
  1179. lstwrt=countcheck(bbspath'Numbers/LastMessage'msgdir 0)
  1180. temp=''
  1181. IF lastread.msgdir>=lstwrt THEN
  1182.   DO
  1183.     lastread.msgdir=lstwrt
  1184.     CALL msgcount(msgdir);
  1185.     IF quietflag=1 THEN RETURN;
  1186.     temp=getinput(1 0 pen3'Enter starting message number > 'def);
  1187.     IF ~DATATYPE(temp,'N') THEN RETURN;
  1188.     IF temp<1 THEN temp=1
  1189.     lastread.msgdir=temp-1
  1190.   END
  1191. dirname=msgpath||msgdir
  1192. testlist=sortnumbers(SHOWDIR(dirname));
  1193. msglist.=0                /* set read to 0, unread to 1, and reply >=2 */
  1194. DO i=1 TO WORDS(testlist)
  1195.   test=WORD(testlist,i)
  1196.   IF test>lastread.msgdir THEN msglist.test=1
  1197. END
  1198. msgstatus=1
  1199. IF temp='' THEN CALL msgcount(msgdir);
  1200. DO msgloop=1 WHILE lastread.msgdir<lstwrt
  1201.   lastreadnum=lastread.msgdir
  1202.   DO WHILE msglist.lastreadnum=0 & lastreadnum<lstwrt
  1203.     lastreadnum=lastreadnum+1
  1204.   END
  1205.   lastread.msgdir=lastreadnum
  1206.   DO mess=lastread.msgdir TO lstwrt+1
  1207.     IF msglist.mess~=msgstatus THEN ITERATE mess
  1208.     IF mess>lstwrt THEN RETURN;
  1209.     IF msgstatus>1 THEN SAY 'Following the thread, level' msgstatus-1'.'CR
  1210.     msglist.mess=0
  1211.     arg=dirname'/'mess
  1212.     IF ~EXISTS(arg) THEN
  1213.       DO
  1214.         SAY 'Message number' mess 'is missing.'CR
  1215.         ITERATE mess
  1216.       END
  1217.     IF ~readopen(arg) THEN ITERATE mess
  1218.     firstline  = READLN(f)
  1219.     secondline = READLN(f)
  1220.     thirdline  = READLN(f)
  1221.     forthline  = READLN(f)
  1222.     CALL CLOSE(f)
  1223.     CALL killmark(msgdir mess)
  1224.     CALL DELAY(28)
  1225.     IF WORDS(firstline)>2 THEN  /* if replies, change their num to 2 */
  1226.       DO
  1227.         thread=SUBSTR(firstline,WORDINDEX(firstline,4))
  1228.         DO tindx=1 TO WORDS(thread)
  1229.           test=WORD(thread,tindx)
  1230.           IF msglist.test~=0 THEN msglist.test=msgstatus+1
  1231.         END
  1232.       END
  1233.     savearg=arg
  1234.     msgcom='A'
  1235.     DO msgloop2=1 WHILE msgcom='A' | msgcom='O'
  1236.       CALL readlines(arg 1);
  1237.       IF nonstop=1 THEN rnonstop=1
  1238.       ELSE rnonstop=0
  1239.       CALL seelines();
  1240.       msgcom=''
  1241.       IF rnonstop THEN
  1242.         DO
  1243.           SAY CR
  1244.           nonstop=1
  1245.           msgcom=''
  1246.         END
  1247.       ELSE
  1248.         DO
  1249.           pline='['pen3'A'def']gain ['pen3'H'def']elp'
  1250.           IF level>sysoplevel | name=WORD(lynes.2,2) THEN
  1251.             pline=pline '['pen3'E'def']dit ['pen3'K'def']ill'
  1252.           IF WORDS(lynes.3)>3 THEN pline=pline '['pen3'O'def']riginal'
  1253.           pline=pline '['pen3'N'def']onStop ['pen3'R'def']eply'
  1254.           pline=pline '['pen3'S'def']kip ['pen3'Q'def']uit'
  1255.           msgcom=getinput(1 0 pline' > ');
  1256.           CALL cleanline(0);
  1257.         END
  1258.       CALL checktime();
  1259.       IF DATATYPE(msgcom,'N') & EXISTS(dirname'/'msgcom) THEN
  1260.         DO
  1261.           arg=dirname'/'msgcom
  1262.           msgcom='A'
  1263.           ITERATE msgloop2
  1264.         END
  1265.       ELSE msgcom=LEFT(msgcom,1)
  1266.       IF msgcom='Q' THEN LEAVE msgloop
  1267.       ELSE IF msgcom='A' THEN ITERATE msgloop2
  1268.       ELSE IF msgcom='N' THEN
  1269.         DO
  1270.           nonstop=1
  1271.           msgcom=''
  1272.         END
  1273.       ELSE IF msgcom='H' THEN
  1274.         DO
  1275.           SAY pen3' - HELP with the Read Messages commands -'def||CR
  1276.           SAY ' RETURN reads the next message in line.'CR
  1277.           SAY ' 34 will read message number 34, if it exists in this conference.'CR
  1278.           SAY ' A  reads this message Again (in case it scrolled off screen).'CR
  1279.           IF level>sysoplevel | name=WORD(lynes.2,2) THEN
  1280.             DO
  1281.           SAY ' E  puts this message into the online Editor.'CR
  1282.           SAY ' K  deletes a message you wrote. you cannot Kill others!'CR
  1283.             END
  1284.           SAY ' N  displays all new messages without pausing. CTRL-E to Exit!'CR
  1285.           SAY ' O  if this message is a reply, will read the Original message.'CR
  1286.           SAY ' R  enters the message editor to Reply to this message.'CR
  1287.           SAY ' S  allows you to Skip threads or conferences.'CR
  1288.           SAY ' Q  returns to the message menu. (Quit)'CR
  1289.           SAY CR
  1290.           CALL waiting();
  1291.           msgcom='A'
  1292.           IF waitchar='Q' THEN LEAVE msgloop
  1293.         END
  1294.       ELSE IF msgcom='E' THEN
  1295.         DO
  1296.           IF level>sysoplevel | name=WORD(lynes.2,2) THEN
  1297.             DO
  1298.               sline=7
  1299.               IF level>sysoplevel THEN sline=1
  1300.               CALL bbsED(sline arg);
  1301.               msgcom='A'
  1302.             END
  1303.         END
  1304.       ELSE IF msgcom='S' THEN
  1305.         DO
  1306.           stemp=getinput(1 1 'Skip this ['pen3'T'def']hread or the entire ['pen3'C'def']onference (tc) > ');
  1307.           IF stemp='T' THEN
  1308.             DO
  1309.               SAY 'Skipping this message AND its replies..'CR
  1310.               DO i=lastread.msgdir TO lstwrt
  1311.                 IF msglist.i>1 THEN msglist.i=0
  1312.               END
  1313.             END
  1314.           ELSE IF stemp='C' THEN
  1315.             DO
  1316.               SAY 'Skipping to the last message in the' msg.msgdir 'conference.'
  1317.               lastread.msgdir=lstwrt-1
  1318.               lw=lstwrt-1
  1319.               msglist.lw=0
  1320.               msglist.lstwrt=1
  1321.               LEAVE mess
  1322.             END
  1323.         END
  1324.       ELSE IF msgcom='K' THEN
  1325.         DO
  1326.           IF level>sysoplevel | name=WORD(lynes.2,2) THEN
  1327.             DO
  1328.               IF getinput(1 1 'Really delete' arg'? (yN) > ')='Y' THEN
  1329.                 DO
  1330.                   CALL DELETE(arg)
  1331.                   SAY pen3||arg||def' has been deleted.'
  1332.                 END
  1333.             END
  1334.         END
  1335.       ELSE IF msgcom='O' THEN   /* go back and read original */
  1336.         DO
  1337.           IF WORDS(lynes.3)>3 THEN
  1338.             DO
  1339.               temp=WORD(lynes.3,4)
  1340.               arg=dirname'/'temp
  1341.             END
  1342.           ELSE SAY 'This is the original message.'CR
  1343.         END
  1344.       ELSE IF msgcom='R' THEN        /*  toname     msgnum  */
  1345.         DO
  1346.           msgnum=WORD(lynes.1,2)
  1347.           IF editor('REPLY' WORD(lynes.2,2) msgnum) THEN /* reply */
  1348.             DO
  1349.               savearg2=arg
  1350.               arg=dirname'/'WORD(lynes.3,4)
  1351.               IF EXISTS(arg) THEN
  1352.                 DO
  1353.                   IF readlines(arg 1) THEN BREAK;
  1354.                   xmsg=countcheck(bbspath'Numbers/LastMessage'msgdir mess)
  1355.                   IF WORDS(lynes.1)>3 THEN lynes.1=lynes.1 xmsg
  1356.                   ELSE lynes.1=lynes.1'   Reply' xmsg
  1357.                   CALL DELAY(28)    /* allow 1/2 sec for read to close */
  1358.                   IF savelines(arg) THEN RETURN;
  1359.                 END
  1360.               arg=savearg2
  1361.             END
  1362.         END
  1363.       ELSE IF arg~=savearg THEN    /* Continue */
  1364.         DO
  1365.           msgcom='A'
  1366.           arg=savearg
  1367.         END
  1368.       CALL checktime();
  1369.     END
  1370.     IF thread~='' THEN
  1371.       DO
  1372.         thread=''
  1373.         msgstatus=msgstatus+1
  1374.       END
  1375.   END
  1376.   IF msgstatus>1 THEN msgstatus=msgstatus-1
  1377. END
  1378. waitchar=''
  1379. nonstop=0
  1380. RETURN;
  1381.  
  1382.  
  1383. showmarked:
  1384. IF WORDS(data.24)<1 THEN RETURN;
  1385. SAY CR
  1386. SAY pen3'These unread conference messages are addressed to you:'def||CR
  1387. DO i=1 TO WORDS(data.24)
  1388.   tempk=WORD(data.24,i)
  1389.   PARSE VAR tempk kdir'/'kmsg
  1390.   SAY RIGHT(kmsg,6) 'in the' msg.kdir 'conference.'CR
  1391. END
  1392. CALL waiting();
  1393. SAY CR
  1394. RETURN;
  1395.  
  1396.  
  1397. killmark:
  1398. PARSE ARG kdir kmsg .
  1399. markword=FIND(data.24,kdir'/'kmsg)
  1400. IF markword>0 THEN data.24=STRIP(DELWORD(data.24,markword,1))
  1401. RETURN;
  1402.  
  1403.  
  1404. sortnumbers:
  1405. PARSE ARG slist
  1406. sorted.=''
  1407. newest=0
  1408. newlist=''
  1409. DO si=1 TO WORDS(slist)
  1410.   tempnum=WORD(slist,si)/1
  1411.   sorted.tempnum=1
  1412.   IF tempnum>newest THEN newest=tempnum
  1413. END
  1414. DO si=1 TO newest
  1415.   IF sorted.si~=1 THEN ITERATE si
  1416.   newlist=newlist si
  1417. END
  1418. RETURN(STRIP(newlist));
  1419.  
  1420.  
  1421. readmail:
  1422. ARG fromenu .
  1423. CALL postuser(3);
  1424. replysubj=''
  1425. IF fromenu THEN
  1426.   DO
  1427.     temp=UPPER(arg)
  1428.     arg=''
  1429.     IF temp~='F' & temp~='T' & temp~='W' THEN
  1430.       DO
  1431.         line='Find Email ['pen3'F'def']rom You ['pen3'T'def']o You or ['pen3'W'def']rite New Email > 'def
  1432.         temp=getinput(1 1 line);
  1433.         CALL cleanline(0);
  1434.       END
  1435.     IF temp='W' THEN
  1436.       DO
  1437.         CALL editor('MAIL');
  1438.         RETURN;
  1439.       END
  1440.     ELSE IF temp='F' THEN
  1441.       DO
  1442.         SAY pen3'You have Email pending to the following users:'def||CR
  1443.         firsteditline=0
  1444.         picklist.=''
  1445.         picklist.0=0
  1446.         DO ei=1 TO WORDS(userlist)
  1447.           fmaillist=SHOWDIR(bbspath'EMail/'WORD(userlist,ei))
  1448.           DO ej=1 TO WORDS(fmaillist)
  1449.             ejname=WORD(fmaillist,ej)
  1450.             uname=ejname
  1451.             caret=LASTPOS('.',uname)
  1452.             IF caret>2 THEN uname=LEFT(uname,caret-1)
  1453.             IF uname=name THEN
  1454.               DO
  1455.                 arg=bbspath'EMail/'WORD(userlist,ei)'/'ejname
  1456.                 IF EXISTS(arg) THEN
  1457.                   DO
  1458.                     pklst=picklist.0+1
  1459.                     picklist.pklst=WORD(userlist,ei)
  1460.                     picklist.pklst.0=ejname
  1461.                     picklist.0=pklst
  1462.                   END
  1463.               END
  1464.           END
  1465.         END
  1466.         IF picklist.0=0 THEN SAY lineup'No Email FROM you was found.                    'CR
  1467.         ELSE
  1468.           DO
  1469.             pickcheck=1
  1470.             DO WHILE pickcheck~=0
  1471.               pickcheck=pickfromlist();
  1472.               IF pickcheck~=0 THEN
  1473.                 DO
  1474.                   firsteditline=5
  1475.                   IF level>sysoplevel THEN firsteditline=1
  1476.                   CALL bbsED(firsteditline bbspath'Email/'picklist.pickcheck'/'picklist.pickcheck.0);
  1477.                 END
  1478.             END
  1479.           END
  1480.         RETURN;
  1481.       END
  1482.     ELSE IF temp='T' THEN BREAK;
  1483.     ELSE RETURN;
  1484.   END
  1485. SAY 'Checking your mailbox..'CR
  1486. nomail=1
  1487. CALL MAKEDIR(bbspath'EMail/'name)
  1488. mailist=SHOWDIR(bbspath'Email/'name)
  1489. IF WORDS(mailist)>0 THEN
  1490.   DO
  1491.     line=WORDS(mailist)
  1492.     IF line>1 THEN line=line 'letters'
  1493.     ELSE line=line 'letter'
  1494.     line=line 'waiting.'
  1495.     SAY line||CR
  1496.     DO ii=1 TO WORDS(mailist)
  1497.       SAY 'Email:' pen3||WORD(mailist,ii)||def||CR
  1498.     END
  1499.     IF ~fromenu THEN
  1500.       IF getinput(1 1 'Read your private mail now? (nY) > ')='N' THEN RETURN;
  1501.   END
  1502. DO letter=1 TO WORDS(mailist)
  1503.   readname=WORD(mailist,letter)
  1504.   uname=readname
  1505.   caret=LASTPOS('.',uname)
  1506.   IF caret>2 THEN uname=LEFT(uname,caret-1)
  1507.   arg=bbspath'Email/'name'/'readname                       /* user has mail! */
  1508.   CALL readlines(arg 1)
  1509.   CALL seelines();
  1510.   nomail=0
  1511.   nonstop=0
  1512.   mailfile=''
  1513.   IF readname~='NEW_USERS' & readname~='NEW_FILES' & WORDS(lynes.2)>3 THEN
  1514.     DO
  1515.       mailfile=WORD(lynes.2,4)
  1516.       curdir=PRAGMA('D')
  1517.       CALL setdir(bbspath'EmailFiles/'name)
  1518.       filesize=WORD(STATEF(mailfile),2)
  1519.       IF getinput(1 1 ' Attached file:' pen3||mailfile||def 'is' pen3||filesize||def 'bytes.  Download now? (nY) > ')~='N' THEN
  1520.         DO
  1521.           savearg=arg
  1522.           arg=mailfile
  1523.           CALL dload();
  1524.           arg=savearg
  1525.         END
  1526.       CALL setdir(curdir)
  1527.     END
  1528.   IF readname~='NEW_USERS' & readname~='NEW_FILES' THEN
  1529.     DO
  1530.       IF getinput(1 1 'Reply to this message? (nY) > ')~='N' THEN
  1531.         DO
  1532.           replysubj=SUBSTR(lynes.4,WORDINDEX(lynes.4,2))
  1533.           CALL editor('MAIL' uname);
  1534.           replysubj=''
  1535.         END
  1536.     END
  1537.   junk=getinput(1 1 'Forward mail from'pen3 uname def'to other users? (yN) > ');
  1538.   IF junk='Y' THEN
  1539.     DO
  1540.       IF selectchosen(1 pen3'Forward Email To: 'def) THEN BREAK;
  1541.       DO ei=1 TO thechosen.0
  1542.         CALL MAKEDIR(bbspath'EMail/'thechosen.ei)
  1543.         forwardarg=bbspath'Email/'thechosen.ei'/'readname
  1544.         ADDRESS COMMAND 'COPY' bbspath'Email/'name'/'readname forwardarg
  1545.         CALL readlines(forwardarg 1);
  1546.         lynes.1=lynes.1'  Forwarded to you by' name TIME('C') DATE()
  1547.         CALL DELETE(forwardarg)
  1548.         CALL savelines(forwardarg);
  1549.         IF WORDS(lynes.2)>3 THEN
  1550.           DO
  1551.             forname=bbspath'EmailFiles/'name'/'WORD(lynes.2,4)
  1552.             IF EXISTS(forname) THEN
  1553.               DO
  1554.                 CALL MAKEDIR(bbspath'EmailFiles/'thechosen.ei)
  1555.                 ADDRESS COMMAND 'COPY' forname bbspath'EmailFiles/'thechosen.ei
  1556.               END
  1557.           END
  1558.         line='Mail' pen3||readname||def 'forwarded to' pen3||thechosen.ei||def
  1559.         CALL send2log(line)
  1560.         SAY line||CR
  1561.       END
  1562.     END
  1563.   IF getinput(1 1 'Delete the mail from'pen3 uname def'you just read? (nY) > 'def)~='N' THEN
  1564.     DO
  1565.       dirname=bbspath'Email/'name'/'
  1566.       CALL DELETE(dirname||readname)
  1567.       tempstr='Mail'
  1568.       IF mailfile~='' & readname~='NEW_USERS' & readname~='NEW_FILES' & EXISTS(bbspath'EmailFiles/'name'/'mailfile) THEN
  1569.         DO
  1570.           CALL DELETE(bbspath'EmailFiles/'name'/'mailfile)
  1571.           tempstr=tempstr 'and attached file'
  1572.         END
  1573.       tempstr=tempstr 'deleted. Thank you for keeping a clean BBS!'
  1574.       SAY tempstr||CR
  1575.     END
  1576.   ELSE IF readname~='NEW_USERS' & readname~='NEW_FILES' THEN
  1577.     DO
  1578.       arg=bbspath'Email/'name'/'readname
  1579.       CALL readlines(arg 1)
  1580.       IF WORDS(lynes.3)<3 THEN
  1581.         DO
  1582.           lynes.3=lynes.3'  (R)'     /* received */
  1583.           CALL DELETE(arg)
  1584.           CALL savelines(arg)
  1585.           SAY 'Email has been marked as received.'CR
  1586.         END
  1587.     END
  1588.   CALL checktime();
  1589.   readname=''
  1590.   uname=''
  1591.   arg=''
  1592. END
  1593. IF nomail THEN
  1594.   DO
  1595.     SAY 'No mail was found.'CR
  1596.     CALL waiting();
  1597.   END
  1598. CALL setdir(libpath||dirs.1);
  1599. thechosen.=''
  1600. RETURN;
  1601.  
  1602.  
  1603. selectchosen:
  1604. PARSE ARG startat selectline
  1605. IF startat<2 THEN thechosen.=''
  1606. line='Enter list of comma separated user names'
  1607. IF level>sysoplevel THEN line=line 'or ALL'
  1608. SAY line||CR
  1609. thechosen.startat=getinput(1 0 selectline' ');
  1610. IF STRIP(thechosen.startat)='' THEN RETURN(1);
  1611. thechosen.startat=SPACE(thechosen.startat,1,'_')
  1612. thechosen.0=startat
  1613. IF level>sysoplevel & thechosen.startat='ALL' THEN
  1614.   thechosen.startat=SHOWDIR(bbspath'Users',,',')
  1615. IF POS(',',thechosen.startat)>0 THEN
  1616.   DO
  1617.     temp=TRANSLATE(thechosen.startat,' ',',')
  1618.     thechosen.0=WORDS(temp)+startat-1
  1619.     DO ei=startat TO thechosen.0
  1620.       thechosen.ei=WORD(temp,ei)
  1621.     END
  1622.   END
  1623. DO ei=startat TO thechosen.0
  1624.   DO WHILE FIND(userlist,thechosen.ei)=0
  1625.     CALL showuserlist();
  1626.     SAY thechosen.ei 'not found! Enter that name again or press RETURN.'CR
  1627.     thechosen.ei=getinput(1 0 pen3'Forward Email To: 'def);
  1628.     thechosen.ei=SPACE(thechosen.ei,1,'_')
  1629.     IF thechosen.ei='' THEN ITERATE ei
  1630.   END
  1631. END
  1632. RETURN(0);
  1633.  
  1634.  
  1635. countcheck:
  1636. PARSE ARG fname' 'cknum' '.
  1637. IF ~EXISTS(fname) THEN
  1638.   DO
  1639.     IF ~writeopen(fname) THEN RETURN(0);
  1640.     CALL WRITELN(f,cknum)
  1641.     CALL CLOSE(f)
  1642.     RETURN(cknum);
  1643.   END
  1644. IF ~readopen(fname) THEN RETURN(cknum);
  1645. retval=STRIP(READLN(f))
  1646. CALL CLOSE(f)
  1647. IF ~DATATYPE(retval,'N') THEN retval=0
  1648. IF ~DATATYPE(cknum,'N') THEN cknum=0
  1649. IF retval<cknum THEN
  1650.   DO
  1651.     IF writeopen(fname) THEN
  1652.       DO
  1653.         CALL WRITELN(f,cknum)
  1654.         CALL CLOSE(f)
  1655.         RETURN(cknum);
  1656.       END
  1657.   END
  1658. RETURN(retval);
  1659.  
  1660.  
  1661. pickfromlist:
  1662. DO pfl=1 TO picklist.0 BY 3
  1663.   pfl2=pfl+1
  1664.   pfl3=pfl+2
  1665.   pfline=pen3||RIGHT(pfl,2)||def LEFT(picklist.pfl,20)
  1666.   IF picklist.pfl2~='' THEN
  1667.     pfline=pfline pen3||RIGHT(pfl2,2)||def LEFT(picklist.pfl2,20)
  1668.   IF picklist.pfl3~='' THEN
  1669.     pfline=pfline pen3||RIGHT(pfl3,2)||def LEFT(picklist.pfl3,20)
  1670.   SAY pfline||CR
  1671. END
  1672. emnum=getinput(1 0 pen3'Select Email Number > 'def);
  1673. IF ~DATATYPE(emnum,'N') | emnum<1 | emnum>picklist.0 THEN RETURN(0);
  1674. RETURN(emnum);
  1675.  
  1676.  
  1677. sysED:
  1678. IF level<99 THEN RETURN;
  1679. arg=getinput(0 0 'Textfile To Edit: ');
  1680. IF arg='' THEN RETURN;
  1681. CALL bbsED(1 arg)
  1682. RETURN;
  1683.  
  1684.  
  1685. bbsED:
  1686. PARSE ARG firstedit editarg .
  1687. notchanged=1
  1688. IF readlines(editarg 1) THEN RETURN(1);
  1689. SAY CR
  1690. SAY '                   'pen3'Entering the EDITOR module..'def||CR
  1691. SAY CR
  1692. count=1
  1693. DO edloop=1
  1694.   IF edcom='S' & bbsprefs.5 THEN  /* spell check */
  1695.     DO
  1696.       SAY pen3'You must use ['def'R'pen3']eplace to make corrections.  'pen2'Spellchecking...'def||CR
  1697.       CALL DELETE(scratch'/SpellFile');
  1698.       CALL savelines(scratch'/SpellFile');
  1699.       curdir=PRAGMA('D')
  1700.       CALL setdir(spellpath);
  1701.       CALL SpellChk.rexx(scratch'/SpellFile');
  1702.       CALL setdir(curdir);
  1703.     END
  1704.   ELSE
  1705.     DO
  1706.       IF edcom='R' | edcom='I' | edcom='L' THEN CALL wrapbuf(7);
  1707.       IF count>=lynes.0 THEN count=1
  1708.       startcount=count
  1709.       DO i=startcount TO lynes.0+1
  1710.         IF ((i+1-startcount)//linesperpage)=0 THEN
  1711.           DO
  1712.             pline='                 ['pen3'E'def']dit'
  1713.             pline=pline '  ['pen3'RETURN'def']=Continue '
  1714.             edcom=getinput(1 1 pline);
  1715.             IF edcom~='' THEN LEAVE i
  1716.             CALL cleanline(1);
  1717.           END
  1718.         SAY pen3||RIGHT(i,2)||def lynes.i||CR
  1719.         count=count+1
  1720.       END
  1721.     END
  1722.   CALL checktime();
  1723.   pline=lineup' ['pen3'A'def']ppend ['pen3'C'def']ut ['pen3'I'def']nsert'
  1724.   pline=pline '['pen3'K'def']ill ['pen3'L'def']ist ['pen3'P'def']aste ['pen3'R'def']eplace'
  1725.   IF bbsprefs.5 THEN pline=pline '['pen3'S'def']pellcheck'
  1726.   pline=pline '> '
  1727.   edcom=getinput(1 1 pline);
  1728.   IF edcom='K' THEN
  1729.     DO
  1730.       junk=getinput(1 1 'Are you' pen3'sure'def 'you want to delete' editarg'? (yN) > ')
  1731.       IF junk='Y' THEN
  1732.         DO
  1733.           CALL DELETE(editarg)
  1734.           SAY editarg 'DELETED.'CR
  1735.           IF WORD(lynes.1,1)='Mail:' & WORDS(lynes.2)>3 THEN
  1736.             DO
  1737.               CALL DELETE(bbspath'EmailFiles/'WORD(lynes.3,2)'/'WORD(lynes.2,4))
  1738.               SAY WORD(lynes.2,4) 'DELETED.'CR
  1739.             END
  1740.           RETURN(2);
  1741.         END
  1742.     END
  1743.   IF edcom='' THEN
  1744.     DO
  1745.       SAY lineup'                   'pen3'Leaving the EDITOR module.                               'def||CR
  1746.       IF notchanged THEN RETURN(0);
  1747.       IF getinput(1 1 '                     Save changes? (nY)'pen3' > 'def)='N' THEN
  1748.         RETURN(1);
  1749.       CALL DELETE(editarg)
  1750.       IF savelines(editarg) THEN RETURN(1);
  1751.       SAY pen3'                        Changes saved.'def||CR
  1752.       RETURN(0);
  1753.     END
  1754.   ELSE IF edcom='C' THEN  /* Cut */
  1755.     DO
  1756.       firstnum=getinput(1 0 '   Enter line number or range 'pen3'(5-7)'def' to cut' pen3'>'def);
  1757.       IF firstnum='' THEN ITERATE edloop
  1758.       dash=POS('-',firstnum)
  1759.       IF dash>0 THEN
  1760.         DO
  1761.           lastnum=STRIP(SUBSTR(firstnum,dash+1))
  1762.           firstnum=STRIP(LEFT(firstnum,dash-1))
  1763.         END
  1764.       ELSE lastnum=firstnum
  1765.       IF ~DATATYPE(firstnum,'N') | ~DATATYPE(lastnum,'N') THEN
  1766.         DO
  1767.           junk=getinput(1 1 pen3'*** You must enter numbers here! 'def);
  1768.           ITERATE edloop
  1769.         END
  1770.       IF lastnum>lynes.0 THEN lastnum=lynes.0
  1771.       IF firstnum<firstedit THEN
  1772.         DO
  1773.           SAY '*** You are not authorized to delete that line!'CR
  1774.           ITERATE edloop
  1775.         END
  1776.       IF firstnum>lastnum THEN
  1777.         DO
  1778.           SAY '*** Input error!  First number larger than last number'CR
  1779.           ITERATE edloop
  1780.         END
  1781.       notchanged=0
  1782.       numdiff=lastnum+1-firstnum
  1783.       pasted.=''
  1784.       pasted.0=numdiff
  1785.       k=0
  1786.       DO i=firstnum TO lynes.0
  1787.         j=i+numdiff
  1788.         k=k+1
  1789.         IF k<=numdiff THEN pasted.k=lynes.i
  1790.         lynes.i=lynes.j
  1791.         lynes.j=''
  1792.       END
  1793.       lynes.0=lynes.0-numdiff
  1794.     END
  1795.   ELSE IF edcom='A' THEN  /* append */
  1796.     DO
  1797.       CALL writebuffer(scratch'/EditorFile');
  1798.       notchanged=0
  1799.     END
  1800.   ELSE IF edcom='F' THEN  /* fileappend */
  1801.     DO
  1802.       OPTIONS PROMPT 'Filename: '
  1803.       PARSE PULL farg
  1804.       IF EXISTS(farg) THEN
  1805.         DO
  1806.           CALL readlines(farg lynes.0+1);
  1807.           notchanged=0
  1808.         END
  1809.     END
  1810.   ELSE IF edcom='I' | edcom='R' | edcom='L' | edcom='P' THEN
  1811.     DO
  1812.       line=pen3'   '
  1813.       IF edcom='L' | edcom='P' THEN line=line'Starting '
  1814.       line=line'Line Number? > 'def
  1815.       ednum=getinput(1 0 line);
  1816.       IF ~DATATYPE(ednum,'N') THEN ITERATE edloop
  1817.       IF edcom='L' THEN
  1818.         DO
  1819.           count=ednum
  1820.           ITERATE edloop
  1821.         END
  1822.       IF ednum<firstedit THEN
  1823.         DO
  1824.           SAY '*** You are not authorized to alter that line!'CR
  1825.           ITERATE edloop
  1826.         END
  1827.       IF edcom='R' THEN   /* replace */
  1828.         DO
  1829.           SAY '   Now reads:'CR
  1830.           SAY pen3||RIGHT(ednum,2)||def lynes.ednum||CR
  1831.           stext=getinput(0 0 pen3'........Search text? >'def);
  1832.           IF LENGTH(stext)=0 THEN
  1833.             DO
  1834.               IF getinput(1 1 lineup||pen3'Replace entire line? (nY) >'def)='N' THEN
  1835.                 ITERATE edloop
  1836.               lynes.ednum=getinput(0 0 pen3||RIGHT(ednum,2)' 'def);
  1837.               notchanged=0
  1838.               ITERATE edloop
  1839.             END
  1840.           found=POS(UPPER(stext),UPPER(lynes.ednum))
  1841.           IF found=0 THEN
  1842.             DO
  1843.               SAY stext' was not found!'CR
  1844.               ITERATE edloop
  1845.             END
  1846.           rtext=getinput(0 0 pen3'...Replacement text? >'def);
  1847.           lynes.ednum=DELSTR(lynes.ednum,found,LENGTH(stext))
  1848.           lynes.ednum=INSERT(rtext,lynes.ednum,found-1)
  1849.           SAY 'Done.'CR
  1850.           SAY CR
  1851.           notchanged=0
  1852.         END
  1853.       ELSE IF edcom='I' THEN   /* insert */
  1854.         DO
  1855.           DO i=lynes.0 TO ednum BY -1
  1856.             j=i+1
  1857.             lynes.j=lynes.i
  1858.           END
  1859.           lynes.ednum=''
  1860.           notchanged=0
  1861.           lynes.0=lynes.0+1
  1862.           lynes.ednum=getinput(0 0 pen3||RIGHT(ednum,2)'>'def);
  1863.         END
  1864.       ELSE IF edcom='P' THEN   /* paste */
  1865.         DO
  1866.           DO i=lynes.0 TO ednum BY -1
  1867.             j=i+pasted.0
  1868.             lynes.j=lynes.i
  1869.           END
  1870.           DO k=1 TO pasted.0
  1871.             kk=ednum+k-1
  1872.             lynes.kk=pasted.k
  1873.           END
  1874.           notchanged=0
  1875.           lynes.0=lynes.0+pasted.0
  1876.         END
  1877.     END
  1878. END
  1879. RETURN(0);
  1880.  
  1881.  
  1882. editor:
  1883. toname=''
  1884. msgnum=0
  1885. thechosen.=''
  1886. PARSE ARG edtype toname msgnum .
  1887. IF edtype='MAIL' THEN lastwrit=countcheck(bbspath'Numbers/LastMail 0')
  1888. ELSE 
  1889.   DO
  1890.     IF edtype='MSG' THEN
  1891.       DO
  1892.         tempmsgdir=0
  1893.         IF DATATYPE(arg,'N') THEN tempmsgdir=arg
  1894.         IF tempmsgdir>0 & tempmsgdir<=level & msg.tempmsgdir~='' THEN
  1895.           msgdir=tempmsgdir
  1896.         ELSE IF areaselect() THEN RETURN;
  1897.       END
  1898.     lastwrit=countcheck(bbspath'Numbers/LastMessage'msgdir' 0')
  1899.   END
  1900. IF toname='' THEN
  1901.   DO
  1902.     IF edtype='MAIL' THEN
  1903.       DO
  1904.         CALL selectchosen(1 pen3'Send' edtype lastwrit+1 'To: 'def);
  1905.         toname=thechosen.1
  1906.       END
  1907.     ELSE toname=getinput(1 0 pen3'Post Message To: 'def);
  1908.   END
  1909. toname=SPACE(toname,1,'_')
  1910. toname=COMPRESS(toname,':/*#?^ ')
  1911. IF toname='' | FIND(exclusionlist,toname)>0 THEN
  1912.   DO
  1913.     IF toname='' & edtype='MSG' THEN toname='ALL'
  1914.     ELSE toname=sysop
  1915.     SAY '                    'lineup||toname'                      'CR
  1916.   END
  1917. IF toname~='ALL' THEN
  1918.   DO
  1919.     IF FIND(userlist,toname)=0 | toname='' THEN
  1920.       DO
  1921.         SAY CR
  1922.         SAY bak2' 'toname' is not on the user list! 'def||CR
  1923.         IF edtype='MAIL' THEN
  1924.           DO
  1925.             CALL showuserlist();
  1926.             RETURN(0);
  1927.           END
  1928.         ELSE
  1929.           DO
  1930.             IF getinput(1 1 'Do you want to use it anyway? (nY) > ')='N' THEN
  1931.               DO
  1932.                 IF getinput(1 1 'Do you want to see the list of current users? (yN) > ')='Y' THEN
  1933.                   DO
  1934.                     CALL showuserlist();
  1935.                     RETURN(0);
  1936.                   END
  1937.               END
  1938.           END
  1939.       END
  1940.   END
  1941. IF edtype='MAIL' THEN
  1942.   DO
  1943.     CALL MAKEDIR(bbspath'EMail/'toname)
  1944.     mailname=bbspath'EMail/'toname'/'name'.'lastwrit+1
  1945.   END
  1946. ELSE
  1947.   DO
  1948.     CALL MAKEDIR(msgpath||msgdir)
  1949.     mailname=msgpath||msgdir'/'lastwrit+1
  1950.   END
  1951. lynes.=''
  1952. IF edtype='MAIL' THEN lynes.1=' Mail:' lastwrit+1
  1953. ELSE lynes.1='  Msg:' lastwrit+1         /*   Msg: MSG# REPLY # # ... */
  1954. lynes.2=' From:' name                   /* From: name  FILE: filename */
  1955. IF edtype~='MAIL' THEN
  1956.   DO
  1957.     temp=TRANSLATE(data.3,'         ','+-.*/()<>')
  1958.     DO i=WORDS(temp) TO 1 BY -1
  1959.       IF DATATYPE(WORD(temp,i),'N') THEN temp=STRIP(DELWORD(temp,i,1))
  1960.       IF UPPER(WORD(temp,i))='USA' THEN temp=STRIP(DELWORD(temp,i,1))
  1961.     END
  1962.     lynes.2=lynes.2' - 'temp           /* if msg, add location (city) */
  1963.   END
  1964. lynes.3='   To:' toname                        /*  To: toname   MSG # */
  1965. subj=''
  1966. IF edtype='REPLY' THEN subj=SUBSTR(forthline,WORDINDEX(forthline,2))
  1967. ELSE IF edtype='MAIL' & replysubj~='' THEN subj=replysubj
  1968. ELSE
  1969.   DO
  1970.     IF opt='C' THEN subj='FEEDBACK'
  1971.     ELSE
  1972.       DO
  1973.         SAY pen3'Enter the'def 'Subject' pen3'of this message (1 line).'def||CR
  1974.         subj=getinput(0 0 pen3': 'def);
  1975.       END
  1976.   END
  1977. lynes.4=' Subj:' subj
  1978. lynes.5=' Date:' DATE('W') DATE()'  'TIME('C')
  1979. IF edtype~='MAIL' THEN lynes.5=LEFT(lynes.5,39) 'Conference:' msg.msgdir
  1980. lynes.6=INSERT('','',1,75,'=')
  1981. IF edtype='REPLY' THEN lynes.3=lynes.3'  MSG 'msgnum
  1982. DO i=1 TO 6
  1983.   SAY lynes.i||CR
  1984. END
  1985. CALL writebuffer(scratch'/MessageFile');
  1986. CALL readlines(scratch'/MessageFile' 7);
  1987. CALL seelines();
  1988. IF savelines(mailname) THEN RETURN(0);
  1989. IF thechosen.0='' THEN
  1990.   DO
  1991.     thechosen.0=1
  1992.     thechosen.1=toname
  1993.   END
  1994. carbons=thechosen.0+1
  1995. DO FOREVER
  1996.   pline=''
  1997.   IF edtype='MAIL' THEN pline='['pen3'C'def']opies'
  1998.   pline=pline '['pen3'E'def']dit ['pen3'K'def']ill ['pen3'R'def']ead'
  1999.   pline=pline '['pen3'U'def']pload-Text ['pen3'S'def']end' edtype'? (ekruS) 'def
  2000.   junk=getinput(1 1 pline);
  2001.   IF junk='E' THEN
  2002.     DO
  2003.       IF level>sysoplevel THEN firstedit=1
  2004.       ELSE firstedit=7
  2005.       IF bbsED(firstedit mailname)=2 THEN RETURN(0);
  2006.       junk='R'
  2007.     END
  2008.   ELSE IF edtype='MAIL' & junk='C' THEN
  2009.     DO
  2010.       CALL selectchosen(carbons pen3'Carbon Copies To: 'def);
  2011.       junk='R'
  2012.     END
  2013.   ELSE IF junk='K' THEN
  2014.     DO
  2015.       CALL DELETE(mailname)
  2016.       SAY edtype 'DELETED.'CR
  2017.       RETURN(0);
  2018.     END
  2019.   ELSE IF junk='U' THEN
  2020.     DO
  2021.       SAY 'Ready to append' pen3'TEXT ONLY'def 'using'pen3 protocol||def||CR
  2022.       pline='Are you SURE your file is un-compressed text? (yN) > '
  2023.       IF getinput(1 1 pline)='Y' THEN
  2024.         DO
  2025.           arg='UploadFile'
  2026.           curdir=PRAGMA('D')
  2027.           CALL setdir(scratch)
  2028.           CALL DELETE(arg)
  2029.           CALL DELETE('tempfile1')
  2030.           IF uload(0)=0 THEN
  2031.             DO
  2032.               CALL RENAME(mailname,'tempfile1')
  2033.               ADDRESS COMMAND 'join tempfile1 UploadFile AS' mailname
  2034.             END
  2035.           CALL setdir(curdir)
  2036.         END
  2037.       junk='R'
  2038.     END
  2039.   IF junk='R' THEN
  2040.     DO
  2041.       CALL readlines(mailname 1);
  2042.       CALL seelines();
  2043.       nonstop=0
  2044.     END
  2045.   ELSE BREAK;
  2046. END
  2047. IF edtype='MAIL' THEN
  2048.   DO
  2049.     IF replysubj~='' & readname~='' & uname~='' THEN
  2050.       DO
  2051.         junk=getinput(1 1 'Attach original mail from' uname'? (yN) > ');
  2052.         IF junk='Y' THEN
  2053.           DO
  2054.             arg=bbspath'Email/'name'/'readname
  2055.             IF ~readlines(arg 1) THEN CALL savelines(mailname);
  2056.           END
  2057.       END
  2058.     junk=getinput(1 1 pen3'Attach a file to this message? (yN) > 'def);
  2059.     IF junk='Y' THEN
  2060.       DO
  2061.         arg=getinput(0 0 'Filename: ')
  2062.         curdir=PRAGMA('D')
  2063.         CALL MAKEDIR(bbspath'EmailFiles/'toname)
  2064.         CALL setdir(bbspath'EmailFiles/'toname)
  2065.         IF uload(0)=0 & WORD(STATEF(bbspath'EmailFiles/'toname'/'arg),1)>1 THEN
  2066.           DO
  2067.             IF arg~='' THEN lynes.2=lynes.2'  FILE: 'arg
  2068.             CALL setdir(curdir)
  2069.             CALL DELETE(mailname)
  2070.             CALL savelines(mailname)
  2071.           END
  2072.         ELSE
  2073.           DO
  2074.             CALL DELETE(bbspath'EmailFiles/'toname'/'arg)
  2075.             SAY pen3'*** Upload failed! ***'def||CR
  2076.           END
  2077.       END
  2078.   END
  2079. IF edtype='MAIL' THEN
  2080.   DO
  2081.     totmail=WORD(data.17,2)
  2082.     IF ~DATATYPE(totmail,'N') THEN totmail=1
  2083.     ELSE totmail=totmail+1
  2084.     data.17=WORD(data.17,1)'  'totmail'  'WORD(data.17,3)
  2085.   END
  2086. ELSE totwrit.msgdir=totwrit.msgdir+1
  2087. CALL readlines(mailname 1)
  2088. DO ui=1 TO thechosen.0
  2089.   IF thechosen.ui='' THEN ITERATE ui
  2090.   IF ui>1 THEN
  2091.     DO
  2092.       CALL MAKEDIR(bbspath'Email/'thechosen.ui)
  2093.       newname=bbspath'Email/'thechosen.ui'/'name'.'lastwrit+1
  2094.       IF ui<carbons THEN lynes.3='   To:' thechosen.ui
  2095.       ELSE
  2096.         DO
  2097.           lynes.1=lynes.1'  (Carbon Copy)'
  2098.           lynes.3='   To:' thechosen.1
  2099.         END
  2100.       CALL savelines(newname)
  2101.       IF WORDS(lynes.2)>3 & EXISTS(bbspath'EmailFiles/'thechosen.1'/'WORD(lynes.2,4)) THEN
  2102.         DO
  2103.           CALL MAKEDIR(bbspath'EmailFiles/'thechosen.ui)
  2104.           ADDRESS COMMAND 'COPY' bbspath'EmailFiles/'thechosen.1'/'WORD(lynes.2,4) bbspath'EmailFiles/'thechosen.ui
  2105.           line2='Copied' WORD(lynes.2,4)
  2106.           SAY line2 'to the' thechosen.ui 'file area.'CR
  2107.           CALL send2log(line2)
  2108.         END
  2109.     END
  2110.   line=edtype':'lastwrit+1 'at' TIME('C') 'to' thechosen.ui
  2111.   IF edtype~='MAIL' THEN
  2112.     DO
  2113.       IF FIND(userlist,thechosen.ui)>0 THEN
  2114.         CALL msgmark(thechosen.ui msgdir lastwrit+1);
  2115.       line=line 'in' msg.msgdir
  2116.     END
  2117.   CALL send2log(line)
  2118.   line=edtype 'Sent To' thechosen.ui
  2119.   IF edtype~='MAIL' THEN line=line 'in the' msg.msgdir 'conference.'
  2120.   SAY line||CR
  2121. END
  2122. IF edtype='MAIL' THEN CALL countcheck(bbspath'Numbers/LastMail 'lastwrit+1)
  2123. ELSE
  2124.   DO
  2125.     IF DATATYPE(msg.msgdir.0,'N') THEN msg.msgdir.0=msg.msgdir.0+1
  2126.     ELSE msg.msgdir.0=1
  2127.     CALL countcheck(bbspath'Numbers/LastMessage'msgdir lastwrit+1)
  2128.   END
  2129. CALL setdir(libpath||dirs.1);
  2130. thechosen.=''
  2131. RETURN(1);
  2132.  
  2133.  
  2134. msgmark:
  2135. PARSE ARG markname markdir markmsg .
  2136. IF OPEN(f,bbspath'Users/'markname)=0 THEN RETURN;
  2137. mlines.=''
  2138. DO mi=1 TO 24
  2139.   mlines.mi=READLN(f)
  2140. END
  2141. mlines.24=STRIP(mlines.24 markdir'/'markmsg)
  2142. CALL SEEK(f,0,'B')
  2143. DO mi=1 TO 24
  2144.   CALL WRITELN(f,mlines.mi)
  2145. END
  2146. CALL CLOSE(f)
  2147. RETURN;
  2148.  
  2149.  
  2150. shell:
  2151. SAY CR
  2152. DO WHILE(UPPER(opt)~='EXIT')
  2153.   SAY bak2||TIME('C')||def PRAGMA('D')||CR
  2154.   OPTIONS PROMPT pen3'Type EXIT to quit AmigaDOS> 'def
  2155.   PARSE PULL opt' 'arg .
  2156.   CALL checkdcd();
  2157.   IF(UPPER(opt)='CD') THEN CALL setdir(arg)
  2158.   ELSE IF exists(opt)~=0 THEN
  2159.     DO
  2160.       IF left(statef(opt),3)='DIR' THEN CALL setdir(opt)
  2161.     END
  2162.   ELSE IF opt~='' & UPPER(opt)~='EXIT' THEN
  2163.     ADDRESS COMMAND opt '<* >*' arg
  2164. END
  2165. RETURN;
  2166.  
  2167.  
  2168. yell:
  2169. IF excuses.1='' THEN
  2170.   DO
  2171.     IF readopen(bbspath'Lists/Excuses') THEN
  2172.       DO
  2173.         DO i=1
  2174.           line=READLN(f)
  2175.           IF EOF(f) THEN BREAK;
  2176.           excuses.i=line
  2177.         END
  2178.         excuses.0=i-1
  2179.         CALL CLOSE(f)
  2180.       END
  2181.   END
  2182. j=TIME('S')//excuses.0+1
  2183. SAY CR
  2184. SAY 'Sorry, your SysOp,' sysop','CR
  2185. IF excuses.j~='' THEN SAY excuses.j||CR
  2186. ELSE SAY 'is not available.'CR
  2187. SAY CR
  2188. IF bbsprefs.13 THEN RETURN;
  2189. SAY 'I''m yelling anyway... If nobody answers, please try again later.'CR
  2190. IF EXISTS(bbspath'BBS_TEXT/YELL.snd') THEN  /* run the sound if its there */
  2191.   ADDRESS COMMAND 'Run Sound' bbspath'BBS_TEXT/YELL.snd'
  2192. IF SHOWLIST('H','SPEAK') THEN  /* check on SPEAK: device */
  2193.   DO
  2194.     IF EXISTS(bbspath'BBS_TEXT/YELL') THEN /* we have yell file */
  2195.       ADDRESS COMMAND 'Run Type >SPEAK:' bbspath'BBS_TEXT/YELL'
  2196.     ELSE                           /* default to SPEAK: */
  2197.       DO
  2198.         IF writeopen('SPEAK:')=0 THEN RETURN;
  2199.         CALL WRITELN(f,'Yo' sysop'.')
  2200.         CALL WRITELN(f,'A uzer wants to chat with you.')
  2201.         CALL WRITELN(f,'Yo' sysop'.')
  2202.         CALL CLOSE(f)
  2203.       END
  2204.   END
  2205. RETURN;
  2206.  
  2207.  
  2208. /* online change to member. Sysop triggered by BumpMember.baud */
  2209. validate:
  2210. IF readopen(bbspath'BBS_TEXT/DEF.MEMBER') THEN
  2211.   DO
  2212.     SAY CR
  2213.     SAY 'You are being auto-validated.  Please wait...'CR
  2214.     SAY CR
  2215.     DO lvi=1 TO 21
  2216.       line=READLN(f)
  2217.       IF lvi=11 THEN data.11=line
  2218.       IF lvi=20 THEN data.20=line
  2219.     END
  2220.     data.21=line
  2221.     CALL CLOSE(f)
  2222.     CALL SetData();
  2223.     CALL saveData(0);
  2224.   END
  2225. ELSE MSG bak2'You need a default member file in BBS_TEXT!   ( BBS_TEXT/DEF.MEMBER )'def
  2226. RETURN;
  2227.  
  2228.  
  2229. /* online time change. Sysop triggered by BumpTime.baud */
  2230. uptime:
  2231. mins=GETCLIP('BBS_minutes')
  2232. IF DATATYPE(mins,'N') THEN
  2233.   DO
  2234.     SAY name', this session''s time has been increased to' mins 'minutes.'CR
  2235.     maxtime=mins*60
  2236.     CALL SETCLIP('BBS_minutes')
  2237.   END
  2238. RETURN;
  2239.  
  2240.  
  2241. /* online level change. Sysop triggered by BumpLevels.baud */
  2242. uplevel:
  2243. levl=GETCLIP('BBS_level')
  2244. IF DATATYPE(levl,'N') THEN
  2245.   DO
  2246.     SAY name', your level has been changed from' data.20 'to' levl'.'CR
  2247.     data.20=levl
  2248.     CALL SetData();
  2249.     CALL SETCLIP('BBS_level')
  2250.     IF menu='NEW' THEN menu='ALL'
  2251.     CALL sortlibraries();
  2252.   END
  2253. RETURN;
  2254.  
  2255.  
  2256. /* online ratio change. Sysop triggered by BumpLevels.baud */
  2257. upratio:
  2258. rats=GETCLIP('BBS_ratio')
  2259. IF DATATYPE(rats,'N') THEN
  2260.   DO
  2261.     SAY name', your upload:download ratio has been changed to 1:'rats'.'CR
  2262.     data.17=rats'  'WORD(data.17,2)'  'WORD(data.17,3)
  2263.     CALL SETCLIP('BBS_ratio')
  2264.   END
  2265. RETURN;
  2266.  
  2267.  
  2268. edfilenote:
  2269. arg=getinput(0 0 pen3'Select File: 'def);
  2270. IF EXISTS(arg) THEN
  2271.   DO
  2272.     ADDRESS COMMAND 'List' arg
  2273.     CALL editcomment();
  2274.   END
  2275. RETURN;
  2276.  
  2277.  
  2278. editcomment:
  2279. SAY 'Please enter a one-line description of' arg'.'CR
  2280. comment=getinput(0 0 pen3': 'def);
  2281. IF LENGTH(comment)>77 THEN comment=STRIP(LEFT(comment,77))
  2282. IF LENGTH(comment)>0 THEN
  2283.   DO
  2284.     comment=SPACE(comment,1,'_')
  2285.     ADDRESS COMMAND 'filenote' directory'/'arg comment
  2286.   END
  2287. RETURN;
  2288.  
  2289.  
  2290. stats:
  2291. ARG indx
  2292. bytes='ERROR?'
  2293. tfail=0
  2294. SetMark 'ErrBlk:'
  2295. IF RC~=0 then
  2296.   DO
  2297.     GetLine
  2298.     string=RESULT
  2299.     PARSE VAR string .'  ' min':'sec . 'Bytes:'bytes .
  2300.     IF DATATYPE(min,'N') & DATATYPE(sec,'N') & DATATYPE(bytes,'N') THEN
  2301.       DO
  2302.         secs=(min*60)+sec
  2303.         temp=STATEF(PRAGMA('D')'/'arg)
  2304.         temp=WORD(temp,2)
  2305.         IF ~DATATYPE(temp,'N') THEN temp=0
  2306.         IF indx=14 & (temp+256)<bytes THEN tfail=1
  2307.         IF indx=15 & temp>(bytes+256) THEN tfail=1
  2308.         IF ~tfail THEN
  2309.           DO
  2310.             PARSE VAR data.indx tfiles 'files' tbytes 'bytes.' .
  2311.             IF ~DATATYPE(tfiles,'N') THEN tfiles=0
  2312.             IF ~DATATYPE(tbytes,'N') THEN tbytes=0
  2313.             tbytes=tbytes+bytes
  2314.             tfiles=tfiles+1
  2315.             IF DATATYPE(secs,'N') THEN
  2316.               Say 'Transfer Speed:' TRUNC(bytes/secs+.05,1) 'characters per second.'CR
  2317.             IF DATATYPE(WORD(data.indx,1),'N') THEN
  2318.                  data.indx=tfiles 'files' tbytes 'bytes.'
  2319.             ELSE data.indx='1 files' bytes 'bytes.'
  2320.             data.indx=data.indx DATE()
  2321.             CALL saveData(0);
  2322.           END
  2323.       END
  2324.     ELSE tfail=1
  2325.     IF tfail THEN
  2326.       DO
  2327.         line=plaindir'/'arg pen3'*** Transfer failed! ***'def
  2328.         SAY line||CR
  2329.         CALL send2log(line)
  2330.         RETURN(1);
  2331.       END
  2332.     line=left(arg,16,' ')
  2333.     IF indx=14 THEN line=line '  uploaded'
  2334.     ELSE line=line 'downloaded'
  2335.     line=line 'at' TIME('C') bytes 'bytes using' protocol 'in' plaindir'.'
  2336.     CALL send2log(line)
  2337.   END
  2338. RETURN(0);
  2339.  
  2340.  
  2341. bbsspace:
  2342. ADDRESS COMMAND 'info >ram:infout' bbsdevice
  2343. ok=OPEN(f,'ram:infout','R')
  2344. IF ok=0 THEN RETURN(20)
  2345. line=READLN(f)
  2346. line=READLN(f)
  2347. line=READLN(f)
  2348. line=READLN(f)
  2349. CALL CLOSE(f)
  2350. SAY CR
  2351. bbsk=WORD(line,4)
  2352. IF ~DATATYPE(bbsk,'N') THEN
  2353.   DO
  2354.     line=bbsdevice 'is not an info compatible device!'
  2355.     CALL send2log(line)
  2356.     SAY pen3||line||def||CR
  2357.     bbsk=0
  2358.     RETURN;
  2359.   END
  2360. bbsk=TRUNC(bbsk/2+.5)
  2361. SAY RIGHT(bbsk,19)'k available for uploads.'CR
  2362. RETURN;
  2363.  
  2364.  
  2365. uload:
  2366. ARG frommenu
  2367. CALL bbsspace();
  2368. IF (bbsk*1000)<SYSTEM_SPACE_LIMIT THEN
  2369.   DO
  2370.     SAY pen3'Upload area is full!'def||CR
  2371.     RETURN(1);
  2372.   END
  2373. IF arg='' THEN arg=getinput(0 0 'Filename: ');   /* no filename given */
  2374. IF arg='' THEN RETURN(1);          /* check for filename */
  2375. arg=TRANSLATE(arg,'     ',':/,;|')   /* be sure no illegals here */
  2376. IF WORDS(arg)>1 THEN arg=STRIP(WORD(arg,1))
  2377. IF frommenu THEN
  2378.   DO
  2379.     SAY 'Please select an appropriate library for' pen3||arg||def'.'CR
  2380.     CALL chdir();
  2381.   END
  2382. filenum=countcheck(bbspath'Numbers/LastFile' 0)
  2383. DO ui=1 TO filenum-1 WHILE frommenu
  2384.   IF WORD(files.ui,2)=arg THEN
  2385.     DO
  2386.       temp=WORD(files.ui,1)
  2387.       line=pen3'*** File' arg 'already exists here in the'
  2388.       line=line temp 'directory.'def
  2389.       SAY line||CR
  2390.       SAY 'Original uploader may ['pen3'K'def']ill the file before uploading the replacement.'CR
  2391.       IF level>sysoplevel & UPPER(plaindir)~=UPPER(temp) THEN LEAVE ui
  2392.       ELSE RETURN(1);
  2393.     END
  2394. END
  2395. checkproto='T'
  2396. targ=arg
  2397. DO WHILE checkproto='T'
  2398.   arg=''
  2399.   SAY CR
  2400.   SAY 'Library:'pen3 plaindir def'  Filename:'pen3 targ def' Protocol:'pen3 protocol||def||CR
  2401.   pline=' ['pen3'Q'def']uit ['pen3'T'def']ransfer-protocol'
  2402.   pline=pline '['pen3'U'def']pload (qtU) > '
  2403.   checkproto=getinput(1 1 pline)
  2404.   IF checkproto='Q' THEN RETURN(1);
  2405.   IF checkproto='T' THEN CALL chpro();
  2406. END
  2407. arg=targ
  2408. CALL postuser(4);
  2409. uploadtime=TIME('E')
  2410. SAY 'Starting' protocol 'transfer'CR
  2411. DownLoad arg
  2412. IF RC>0 | stats(14) THEN RETURN(1);
  2413. IF bbsprefs.9 THEN
  2414.   DO
  2415.     newufile=bbspath'EMail/'sysop'/NEW_FILES'
  2416.     IF EXISTS(newufile) THEN ok=OPEN(f,newufile,'A')
  2417.     ELSE ok=OPEN(f,newufile,'W')
  2418.     IF ok~=0 THEN CALL WRITELN(f,name 'uploaded' plaindir'/'arg'  'DATE() TIME())
  2419.     CALL CLOSE(f)
  2420.   END
  2421. IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN(0);
  2422. DO ui=sysoplevel+2 TO 100
  2423.   IF UPPER(dirs.ui)=UPPER(temp) THEN RETURN(0);
  2424. END
  2425. IF frommenu THEN
  2426.   DO
  2427.     uploadtime=TIME('E')-uploadtime
  2428.     DO WHILE editnote(PRAGMA('D')'/'arg)  /* INSIST on a filenote */
  2429.     END
  2430.     IF bbsprefs.11 THEN
  2431.       DO
  2432.         maxtime=maxtime+uploadtime+60
  2433.         line='This session''s time has been increased by'
  2434.         line=line TRUNC(uploadtime%60+.05,1)+1 'minutes.'
  2435.         SAY CR
  2436.         SAY line||CR
  2437.       END
  2438.     IF bbsprefs.6 THEN   /* need sysop approval */
  2439.       DO
  2440.         SAY 'Your upload is being placed in the Sysops area for review...'CR
  2441.         CALL MAKEDIR(libpath'Sysops')
  2442.         CALL MAKEDIR(bbspath'FileNotes/Sysops')
  2443.         lastfilenumber=countcheck(bbspath'Numbers/LastFile' 0)
  2444.         CALL readlines(bbspath'FileNotes/'plaindir'/'arg 1);
  2445.         CALL movefile(lastfilenumber 'Sysops');
  2446.       END
  2447.   END
  2448. RETURN(0);
  2449.  
  2450.  
  2451. findfiles:
  2452. PARSE ARG ffile
  2453. IF ~EXISTS(ffile) THEN
  2454.   DO
  2455.     nextfilenum=countcheck(bbspath'Numbers/LastFile' 0)+1
  2456.     DO ui=1 TO nextfilenum
  2457.       argtemp=WORD(files.ui,2)
  2458.       IF UPPER(argtemp)=UPPER(ffile) THEN
  2459.         DO
  2460.           dirtemp=WORD(files.ui,1)
  2461.           dirtemp=libpath||dirtemp
  2462.           CALL setdir(dirtemp)
  2463.           RETURN(0);
  2464.         END
  2465.       IF ui=nextfilenum THEN
  2466.         DO
  2467.           SAY '***' ffile 'does not exist!'CR
  2468.           RETURN(1);
  2469.         END
  2470.     END
  2471.   END
  2472. RETURN(0);
  2473.  
  2474.  
  2475. statuscheck:
  2476. PARSE ARG ffile
  2477. IF level>sysoplevel | POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN(0);
  2478. updownratio=WORD(data.17,1)
  2479. IF ~DATATYPE(updownratio,'N') THEN updownratio=100
  2480. upbytes=WORD(data.14,3)
  2481. IF ~DATATYPE(upbytes,'N') THEN upbytes=1
  2482. dnbytes=WORD(data.15,3)
  2483. IF ~DATATYPE(dnbytes,'N') THEN dnbytes=1
  2484. dbytes=WORD(STATEF(ffile),2)
  2485. IF ~DATATYPE(dbytes,'N') THEN dbytes=1
  2486. IF ~DATATYPE(bps,'N') THEN bps=2400
  2487. needtime=dbytes%(bps%10)
  2488. SAY CR
  2489. SAY 'At least' TRUNC(needtime/60+.05,1) 'minutes needed to download' ffile 'at' bps 'baud.'CR
  2490. SAY 'After this transfer your upload:download ratio will be 1:'TRUNC((dbytes+dnbytes)/upbytes)||CR
  2491. IF updownloadratio>0 & (dnbytes/upbytes)>updownratio THEN
  2492.   DO
  2493.     SAY CR
  2494.     line=pen3'       *** You must upload before you do any more downloading! ***'def
  2495.     SAY line||CR
  2496.     CALL send2log('*** Exceeded Download Ratio 1:'TRUNC(dnbytes/upbytes))
  2497.     SAY '  Maintain a ratio of at least 1 byte uploaded for each' updownratio 'bytes downloaded.'CR
  2498.     IF bbsprefs.4 THEN RETURN(1);
  2499.     SAY pen3'             - This requirement is temporarily suspended. -'def||CR
  2500.     SAY CR
  2501.   END
  2502. IF (needtime+TIME('E'))>maxtime THEN
  2503.   DO
  2504.     SAY CR
  2505.     SAY 'Sorry, not enough time left in this session to download' dbytes 'bytes.'CR
  2506.     CALL send2log(needtime%60 'mins needed to dl' ffile 'at' dbytes 'bytes!'def)
  2507.     IF needtime>(WORD(data.11,1)*60) THEN  /* more than maxtime needed */
  2508.       SAY 'Leave email to the sysop to make other arrangements to receive this file.'CR
  2509.     SAY CR
  2510.     RETURN(1);
  2511.   END
  2512. RETURN(0);
  2513.  
  2514.  
  2515. dload:
  2516. errorflag=0
  2517. curdir=PRAGMA('D')
  2518. OPTIONS PROMPT 'Filenames and/or numbers: '
  2519. IF arg='' THEN PARSE PULL arg  /* no filename given */
  2520. IF DATATYPE(arg,'N') THEN arg=WORD(files.arg,2)
  2521. IF arg='' THEN RETURN;
  2522. allargs=TRANSLATE(arg,'     ',':/,;|')
  2523. tempargs=allargs
  2524. SAY 'Working...'lineup||CR
  2525. DO di=1 TO WORDS(tempargs) WHILE STRIP(allargs)~=''
  2526.   arg=WORD(tempargs,di)
  2527.   IF DATATYPE(arg,'N') THEN
  2528.     DO
  2529.       wloc=WORDINDEX(allargs,FIND(allargs,arg))
  2530.       allargs=DELWORD(allargs,FIND(allargs,arg),1)
  2531.       arg=WORD(files.arg,2)
  2532.       allargs=INSERT(arg' ',allargs,wloc-1)
  2533.     END
  2534.   IF findfiles(arg) THEN allargs=DELWORD(allargs,FIND(allargs,arg),1)
  2535. END
  2536. IF STRIP(allargs)='' THEN RETURN;
  2537. sleepy='T'
  2538. DO WHILE sleepy='T'
  2539.   arg=''
  2540.   SAY 'Filename(s)'pen3 allargs def' Protocol:'pen3 protocol||def||CR
  2541.   pline=' ['pen3'A'def']uto-Logoff-after-transfer ['pen3'D'def']ownload'
  2542.   pline=pline '['pen3'Q'def']uit ['pen3'T'def']ransfer-protocol (aDqt)'
  2543.   sleepy=getinput(1 1 pline '> ')
  2544.   IF sleepy='Q' THEN RETURN;
  2545.   IF sleepy='A' THEN sleepy='LOGOFF'
  2546.   IF sleepy='T' THEN CALL chpro();
  2547. END
  2548. DO WHILE allargs~=''
  2549.   arg=STRIP(WORD(allargs,1))
  2550.   allargs=STRIP(DELWORD(allargs,1,1))
  2551.   DO dloadloop=1
  2552.     IF findfiles(arg) | statuscheck(arg) THEN
  2553.       DO
  2554.         errorflag=1
  2555.         LEAVE dloadloop
  2556.       END
  2557.     CALL checktime();
  2558.     CALL postuser(5);
  2559.     SAY 'Starting' protocol 'transfer'CR
  2560.     UpLoad arg
  2561.     IF RC>0 | stats(15) THEN
  2562.       DO
  2563.         errorflag=1
  2564.         LEAVE dloadloop
  2565.       END
  2566.     IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN LEAVE dloadloop
  2567.     DO di=sysoplevel+2 TO 100
  2568.       IF UPPER(dirs.di)=UPPER(plaindir) THEN LEAVE dloadloop
  2569.     END
  2570.     notename=bbspath'FileNotes/'plaindir'/'arg    /* increment download count */
  2571.     IF readlines(notename 1) THEN
  2572.       DO
  2573.         CALL send2log('Unable to increment download count for' plaindir'/'arg);
  2574.         LEAVE dloadloop
  2575.       END
  2576.     dls=WORD(lynes.2,7)
  2577.     IF ~DATATYPE(dls,'N') THEN dls=0
  2578.     lynes.2=STRIP(DELWORD(lynes.2,7,1)) dls+1
  2579.     CALL DELETE(notename)
  2580.     CALL savelines(notename)
  2581.     LEAVE dloadloop
  2582.   END
  2583.   END
  2584. CALL setdir(curdir);
  2585. IF sleepy='LOGOFF' THEN SIGNAL LOGOUT2
  2586. IF errorflag THEN SAY pen3'*** Download Failed!'def||CR
  2587. RETURN;
  2588.  
  2589.  
  2590. editnote:
  2591. IF arg='' THEN
  2592.   DO
  2593.     PARSE PULL arg .
  2594.     IF arg='' | findfiles(arg)>0 THEN RETURN;
  2595.   END
  2596. slash=LASTPOS('/',arg)
  2597. IF slash=0 THEN slash=LASTPOS(':',arg)
  2598. IF slash>0 THEN
  2599.   DO
  2600.     filedir=LEFT(arg,slash-1)
  2601.     filedir=SUBSTR(filedir,5)
  2602.     arg=SUBSTR(arg,slash+1)
  2603.   END
  2604. ELSE filedir=plaindir
  2605. CALL MAKEDIR(bbspath'FileNotes/'filedir)
  2606. IF ~EXISTS(bbspath'FileNotes/'filedir) THEN
  2607.   DO
  2608.     SAY pen3'*** Failed to open directory!' filedir||def||CR
  2609.     RETURN(0);
  2610.   END
  2611. notename=bbspath'FileNotes/'filedir'/'arg
  2612. lynes.=''
  2613. filenum=countcheck(bbspath'Numbers/LastFile' 0)
  2614. IF level>sysoplevel THEN firstedit=1
  2615. ELSE firstedit=5
  2616. IF EXISTS(notename) THEN
  2617.   DO
  2618.     CALL bbsED(firstedit notename);
  2619.     RETURN(0);
  2620.   END
  2621. ELSE
  2622.   DO
  2623.     filedata=STATEF(libpath||filedir'/'arg)
  2624.     IF filedata='' THEN
  2625.       DO
  2626.         SAY filedir'/'arg 'does not exist!'CR
  2627.         RETURN(0);
  2628.       END
  2629.     bytes=WORD(filedata,2)
  2630.     filenum=filenum+1
  2631.     lynes.0=4
  2632.     lynes.1='File: 'LEFT(filenum,6)'KeyWords:'
  2633.     lynes.2='Name: 'LEFT(arg,28)'Size: 'bytes' bytes   Downloads: 0'
  2634.     lynes.3='  By: 'LEFT(name,28)'Date: 'DATE() TIME('C')'  Lib: 'filedir
  2635.     lynes.4=INSERT('','',1,75,'=')
  2636.     SAY 'Please enter a list of keywords to be used by the search routine.'CR
  2637.     SAY INSERT('','',1,75,'=')||CR
  2638.     templine=getinput(0 0 pen3'              KeyWords: 'def);
  2639.     lynes.1=lynes.1 templine
  2640.   END
  2641. CALL seelines();
  2642. CALL writebuffer(scratch'/NoteFile');
  2643. CALL readlines(scratch'/NoteFile' 5);
  2644. IF savelines(notename) THEN RETURN(0);
  2645. fncom='R'
  2646. DO WHILE fncom='R'
  2647.   line='['pen3'C'def']ancel ['pen3'E'def']dit'
  2648.   IF level>sysoplevel THEN line=line '['pen3'K'def']ill'
  2649.   line=line '['pen3'R'def']ead ['pen3'S'def']ave'
  2650.   IF level>sysoplevel THEN line=line '(cekrS) 'def
  2651.   ELSE line=line '(cerS) 'def
  2652.   fncom=getinput(1 1 line);
  2653.   IF fncom='C' THEN RETURN(1);
  2654.   ELSE IF fncom='K' THEN
  2655.     DO
  2656.       IF level>sysoplevel THEN
  2657.         DO
  2658.           SAY 'Killing FileNote..'CR
  2659.           CALL DELETE(notename)
  2660.           RETURN(1);
  2661.         END
  2662.     END
  2663.   ELSE IF fncom='E' THEN
  2664.     DO
  2665.       IF bbsED(firstedit notename)>0 THEN RETURN(0);
  2666.       fncom='R'
  2667.     END
  2668.   ELSE IF fncom~='R' THEN
  2669.     DO
  2670.       SAY 'Saving FileNote..'CR
  2671.       IF filenum<1 THEN filenum=1
  2672.       CALL countcheck(bbspath'Numbers/LastFile' filenum)
  2673.       files.0=files.0+1
  2674.       files.filenum=plaindir arg
  2675.       CALL savefilelist();
  2676.       CALL seelines();
  2677.       CALL waiting();
  2678.       RETURN(0);
  2679.     END
  2680.   CALL seelines();
  2681.   nonstop=0
  2682. END
  2683. RETURN(0);
  2684.  
  2685.  
  2686. savefilelist:
  2687. xarg=bbspath'Lists/Files'
  2688. IF WORD(STATEF(xarg),1)>5 THEN
  2689.   DO
  2690.     CALL DELETE(xarg'.BAK')
  2691.     CALL RENAME(xarg,xarg'.BAK')
  2692.   END
  2693. filenum=countcheck(bbspath'Numbers/LastFile' 0)
  2694. IF filenum<1 | writeopen(xarg)=0 THEN RETURN(0);
  2695.   DO i=1 TO filenum
  2696.     IF files.i='' THEN ITERATE
  2697.     CALL WRITELN(f,i files.i)
  2698.   END
  2699. CALL CLOSE(f)
  2700. RETURN;
  2701.  
  2702.  
  2703. viewuser:
  2704. SAY CR
  2705. SAY bak2' 'name' 'def||CR
  2706. DO i=1 TO 18
  2707.   stuff=data.i
  2708.   IF i=13 | i=14 THEN stuff=DATE(,data.i,'S')
  2709.   SAY RIGHT(i,2)||pen3 text.i||def':' stuff||CR
  2710. END
  2711. CALL waiting();
  2712. RETURN;
  2713.  
  2714.  
  2715. edituser:
  2716. new=0
  2717. change=0
  2718. edata.=''
  2719. edname=name
  2720. DO i=0 TO data.0
  2721.   edata.i=data.i
  2722. END
  2723. num=1
  2724. DO WHILE num~='' | edname~=name
  2725.   IF num='' THEN
  2726.     DO
  2727.       IF change THEN
  2728.         DO
  2729.           CALL SetData();
  2730.           CALL saveData(1);
  2731.           change=0
  2732.         END
  2733.       IF new THEN
  2734.         DO
  2735.           data.=''
  2736.           DO i=0 TO edata.0
  2737.             data.i=edata.i
  2738.           END
  2739.           name=edname
  2740.           new=0
  2741.         END
  2742.       CALL SetData();
  2743.     END
  2744.   maxnum=10
  2745.   IF edata.20>sysoplevel THEN maxnum=20
  2746.   IF edata.20=99 THEN maxnum=24
  2747.   SAY bak2' 'name' 'def||CR
  2748.   maxlines=21
  2749.   IF maxnum=10 THEN maxlines=20
  2750.   DO i=1 TO maxlines
  2751.     IF i=5 & name~=edname & edata.20<99 THEN ITERATE;
  2752.     SAY RIGHT(i,2)||pen3 text.i||def':' data.i||CR
  2753.   END
  2754.   IF edata.20>sysoplevel THEN
  2755.     DO
  2756.       line=LEFT(' ',50)
  2757.       IF name=edname THEN line=line'NEW = Change User.'
  2758.       line=pen3||line||def||lineup
  2759.       SAY line||CR
  2760.     END
  2761.   num=getinput(1 0 'Select Line Number To Edit: ');
  2762.   IF num='NEW' & edata.20>sysoplevel & edname=name THEN    /* select a new user */
  2763.     DO
  2764.       new=1
  2765.       IF change THEN
  2766.         DO
  2767.           CALL SetData();
  2768.           CALL saveData(1)
  2769.         END
  2770.       change=0
  2771.       nufile=bbspath'Email/'sysop'/NEW_USERS'
  2772.       IF EXISTS(nufile) THEN
  2773.         IF ~readlines(nufile 1) THEN CALL seelines();
  2774.       savename=name
  2775.       name=getinput(1 0 'New User Name: 'def);
  2776.       name=SPACE(name,1,'_')
  2777.       name=COMPRESS(name,':/*#?^')
  2778.       IF loadData()=0 THEN name=savename
  2779.       IF data.20>=edata.20 THEN
  2780.         DO
  2781.           SAY 'Can''t Edit!' pen3||name def'has an equal or higher level than thee.'
  2782.           name=savename
  2783.           CALL loadData()
  2784.         END
  2785.     END
  2786.   ELSE IF DATATYPE(num,'N') & num>0 THEN
  2787.     DO
  2788.       IF num>maxnum THEN
  2789.         DO
  2790.           SAY CR
  2791.           SAY pen3'You are not authorized to change that information!'def||CR
  2792.           SAY CR
  2793.         END
  2794.       ELSE
  2795.         DO dummy=1 TO 1
  2796.           line=RIGHT(num,2)||pen3 text.num||def': '
  2797.           SAY line||data.num||CR
  2798.           temp=getinput(0 0 line);
  2799.           IF temp='' THEN
  2800.             DO
  2801.               IF num=1 | num=4 | num=5 | num=6 | num=7 THEN LEAVE dummy;
  2802.               IF num=11 | num=12 | num=13 | num=20 THEN LEAVE dummy;
  2803.             END
  2804.           IF num=5 | num=8 THEN temp=UPPER(temp)
  2805.           IF num=20 & DATATYPE(temp,'N') & temp>=edata.20 THEN
  2806.             temp=data.20
  2807.           IF edata.20>sysoplevel & name~=edname THEN line2=name' '
  2808.           ELSE line2=''
  2809.           IF num=21 & name=edname & edata.20<99 THEN LEAVE dummy
  2810.           line=text.num':' data.num pen6'CHANGED TO'def temp
  2811.           CALL send2log(line2||line)
  2812.           data.num=temp
  2813.           SAY line||CR
  2814.           SAY CR
  2815.           change=1
  2816.         END
  2817.     END
  2818. END
  2819. IF change THEN
  2820.   DO
  2821.     CALL SetData();
  2822.     CALL saveData(1);
  2823.   END
  2824. RETURN;
  2825.  
  2826.  
  2827. getname:
  2828. CALL showuserlist();
  2829. name=getinput(1 0 'Please enter your Email name : ');
  2830. IF name='' THEN
  2831.   DO
  2832.     SAY 'No name, no entry.  Bye!'CR
  2833.     SIGNAL DONE
  2834.   END
  2835. name=SPACE(name,1,'_')
  2836. name=COMPRESS(name,':/*#?^')
  2837. IF FIND(userlist,name)>0 | FIND(exclusionlist,name)>0 THEN
  2838.   DO
  2839.     SAY 'Sorry! That name is taken. Please try again.'CR
  2840.     RETURN(1);
  2841.   END
  2842. RETURN(0);
  2843.  
  2844.  
  2845. /** see if name is in data */
  2846.  
  2847. checkUser:
  2848. tries=0
  2849. IF name='NEW' THEN
  2850.   DO
  2851.     name=''
  2852.     DO WHILE getname()
  2853.     END
  2854.   END
  2855. IF FIND(userlist,name)=0 THEN
  2856.   DO
  2857.     IF EXISTS(bbspath'BBS_TEXT/NEW') THEN
  2858.       DO
  2859.         CALL readlines(bbspath'BBS_TEXT/NEW' 1);
  2860.         CALL seelines();
  2861.         CALL waiting();
  2862.       END
  2863.     SAY CR
  2864.     defile=bbspath'BBS_TEXT/DEF.NEW_USER'
  2865.     wordnum=FIND(courtesy,name)
  2866.     IF wordnum>0 THEN
  2867.       DO
  2868.         SAY name', is on the Courtesy List. You will be granted immediate access.'CR
  2869.         courtesy=STRIP(DELWORD(courtesy,wordnum,1))
  2870.         IF writeopen(bbspath'Lists/Courtesy') THEN
  2871.           DO
  2872.             DO i=1 TO WORDS(courtesy)
  2873.               CALL WRITELN(f,WORD(courtesy,i))
  2874.             END
  2875.             CALL CLOSE(f)
  2876.           END
  2877.         defile=bbspath'BBS_TEXT/DEF.COURTESY'
  2878.       END
  2879.     ELSE SAY name', You have new user access.'CR
  2880.     IF readlines(defile 1) THEN SIGNAL DONE
  2881.     data.=''
  2882.     data.0=24
  2883.     DO i=6 TO 21
  2884.       data.i=lynes.i
  2885.     END
  2886.     data.12=DATE('S')'  'TIME('C')
  2887.     data.13=data.12
  2888.     lastondate=DATE('I')-1
  2889.     SAY 'Please enter the password you would like to use here.'CR
  2890.     data.5=getinput(1 0 'Password: 'pen0);
  2891.     IF data.5='' THEN
  2892.       DO
  2893.         line=def||name 'refused to enter a password.'
  2894.         SIGNAL DONE
  2895.       END
  2896.     data.1=''
  2897.     DO WHILE data.1=''
  2898.       data.1=getinput(0 0 def'Full Name: ');
  2899.       IF data.1='' THEN SAY 'You MUST leave your real name!'CR
  2900.     END
  2901.     data.2=getinput(0 0 'Street: ');
  2902.     data.3=getinput(0 0 'City, State Zip: ');
  2903.     data.4=''
  2904.     DO WHILE data.4=''
  2905.       data.4=getinput(0 0 'Phone: ');
  2906.       IF data.4='' THEN
  2907.         SAY sysop 'MUST be able to reach you by phone to validate you!'CR
  2908.     END
  2909.     age=getinput(0 0 'Age: ');
  2910.     data.12=data.12'  Age:' age
  2911.     IF bbsprefs.8 THEN
  2912.       DO
  2913.         newufile=bbspath'EMail/'sysop'/NEW_USERS'
  2914.         IF EXISTS(newufile) THEN ok=OPEN(f,newufile,'A')
  2915.         ELSE ok=OPEN(f,newufile,'W')
  2916.         IF ok~=0 THEN CALL WRITELN(f,DATE() TIME() name'='data.1'   'data.4)
  2917.         CALL CLOSE(f)
  2918.       END
  2919.     data.9=getinput(0 0 'Computer: ');
  2920.     data.10=getinput(0 0 'Interests: ');
  2921.     test=getinput(1 1 pen3'Do you want other users to see your STREET address? (yN) > 'def);
  2922.     IF test='Y' THEN data.8=data.8 'STREET'
  2923.     test=getinput(1 1 pen3'Do you want other users to see your PHONE number? (yN) > 'def);
  2924.     IF test='Y' THEN data.8=data.8 'PHONE'
  2925.     SAY CR
  2926.     IF data.20=0 THEN
  2927.       SAY 'Thank you, the sysop will give you higher access soon.'CR
  2928.     SAY 'Please feel free to leave additional info by using [C]omment.'CR
  2929.     SAY CR
  2930.     CALL SetData();
  2931.     CALL saveData(1);
  2932.     SAY 'Adding' name 'to the user list...'CR
  2933.     newpassword=data.5
  2934.     CALL sortuserlist();
  2935.   END
  2936. ELSE
  2937.   DO
  2938.     IF loadData()=0 THEN SIGNAL DONE
  2939.     PARSE VAR data.11 amins . atimes .
  2940.     lastondate=DATE('I',WORD(data.13,1),'S')
  2941.     IF DATE('I')>lastondate THEN atimes=3
  2942.     IF level>sysoplevel THEN atimes=3
  2943.     IF level=99 THEN amins=120
  2944.     data.13=DATE('S')'  'TIME()
  2945.     data.11=amins 'minutes' atimes-1 'more times today'
  2946.     IF atimes<1 & DATE('I')=lastondate THEN
  2947.       DO
  2948.         SAY CR
  2949.         SAY CR
  2950.         line= 'Too many calls today.   Call tomorrow.'
  2951.         SAY line||CR
  2952.         SAY CR
  2953.         SAY CR
  2954.         CALL send2log(line)
  2955.         SIGNAL LOGOUT
  2956.       END
  2957.     data.13=DATE('S')'  'TIME('C')
  2958.     SAY pen3'Password will'def 'NOT' pen3'be echoed.'def||CR
  2959.     SAY CR
  2960.     passprompt='Enter Password: 'pen0
  2961.     DO tries=1 TO 3
  2962.       Send passprompt
  2963.       Remote OFF
  2964.       OPTIONS PROMPT ''
  2965.       newpassword=getinput(1 0 '')
  2966.       Remote ON
  2967.       IF(password=newpassword) THEN
  2968.         DO
  2969.           SAY def||CR
  2970.           LEAVE tries; /* correct password */
  2971.         END
  2972.       IF(tries=3) THEN
  2973.         DO                            /* 3 tries, hang up */
  2974.           SAY def||CR
  2975.           SAY 'Access terminated.'CR
  2976.           line='*** Bad password ***'
  2977.           SIGNAL OUT
  2978.         END
  2979.       SAY def||lineup'                                 'CR
  2980.       passprompt='Incorrect.  Password: ' /* ask again */
  2981.     END
  2982.   END
  2983. CALL DELAY(14)
  2984. SAY CR
  2985. RETURN;
  2986.  
  2987.  
  2988. saveData:
  2989. ARG messflag .
  2990. IF data.5='' THEN RETURN;
  2991. SAY 'Updating...'lineup||CR
  2992. Status Trans
  2993. data.6 = RESULT
  2994. IF newfilesdate~='' THEN data.16=lastbrowse newfilesdate
  2995. ELSE IF lastbrowse>0 THEN
  2996.   DO
  2997.     IF WORDS(data.16)>1 THEN data.16=DELWORD(data.16,1,1)
  2998.     ELSE data.16=DATE('S') TIME()
  2999.     data.16=lastbrowse data.16
  3000.   END
  3001. IF messflag THEN
  3002.   DO
  3003.     userexclude.=0
  3004.     DO si=1 TO WORDS(data.22)
  3005.       IF WORD(data.22,si)=-1 THEN userexclude.si=1
  3006.     END
  3007.     data.22=''
  3008.     data.23=''
  3009.     DO si=1 TO level
  3010.       IF ~DATATYPE(lastread.si,'N') THEN lastread.si=0
  3011.       IF userexclude.si THEN data.22=data.22 '-1'
  3012.       ELSE data.22=data.22 lastread.si
  3013.       IF ~DATATYPE(totwrit.si,'N') THEN totwrit.si=0
  3014.       data.23=data.23 totwrit.si
  3015.     END
  3016.   END
  3017. IF writeopen(bbspath'USERS/'name)=0 THEN RETURN;
  3018. IF data.0<24 THEN data.0=24
  3019. DO i=1 TO data.0
  3020.   CALL WRITELN(f,data.i)
  3021. END
  3022. CALL CLOSE(f)
  3023. SAY 'User file' name 'has been updated.'CR
  3024. RETURN;
  3025.  
  3026.  
  3027. loadData:
  3028. IF name='' THEN RETURN(0);
  3029. IF ~readopen(bbspath'USERS/'name) THEN RETURN(0);
  3030. data.=''
  3031. DO i=1
  3032.   line=READLN(f)
  3033.   IF EOF(f) THEN BREAK;
  3034.   data.i=line
  3035. END
  3036. data.0=i-1
  3037. CALL CLOSE(f)
  3038. winnings=WORD(data.18,1)
  3039. IF ~DATATYPE(winnings,'N') THEN winnings=0
  3040.  
  3041. setData:
  3042. IF WORDS(data.16)<3 THEN data.16='0 19900101 00:00:00'
  3043. lastbrowse=WORD(data.16,1)
  3044. level=data.20
  3045. DO i=1 TO level
  3046.   lastread.i=WORD(data.22,i)
  3047.   IF ~DATATYPE(lastread.i,'N') THEN lastread.i=0
  3048.   totwrit.i=WORD(data.23,i)
  3049.   IF ~DATATYPE(totwrit.i,'N') THEN totwrit.i=0
  3050. END
  3051. password=data.5
  3052. IF data.6='' THEN
  3053.   DO
  3054.     Status Trans
  3055.     data.6 = RESULT
  3056.   END
  3057. ELSE Set data.6
  3058. linesperpage=data.7
  3059. IF FIND(UPPER(data.8),'COLOR')>0 THEN colorflag=1
  3060. ELSE colorflag=0
  3061. CALL colors(colorflag)
  3062. IF FIND(UPPER(data.8),'MENUS')>0 THEN menuflag=1
  3063. ELSE menuflag=0
  3064. IF FIND(UPPER(data.8),'MENU')>0 THEN
  3065.   DO
  3066.     menu='ALL'
  3067.     menuflag=1
  3068.   END
  3069. data.21=UPPER(data.21)
  3070. maxtime=WORD(data.11,1)*60
  3071. RETURN(1);
  3072.  
  3073.  
  3074. switchmenuflag:
  3075. IF menuflag=1 THEN
  3076.   DO
  3077.     menuflag=0
  3078.     noff='OFF'
  3079.   END
  3080. ELSE
  3081.   DO
  3082.     menuflag=1
  3083.     noff='ON'
  3084.   END
  3085. SAY 'Menus turned' pen3||noff||def'.'CR
  3086. SAY 'To make a permanent change, add or delete MENU(S) from [Y]our userdata item 8.'CR
  3087. RETURN;
  3088.  
  3089.  
  3090. switchcolors:
  3091. IF colorflag=1 THEN
  3092.   DO
  3093.     colorflag=0
  3094.     noff='OFF'
  3095.   END
  3096. ELSE
  3097.   DO
  3098.     colorflag=1
  3099.     noff='ON'
  3100.   END
  3101. CALL colors(colorflag);
  3102. SAY 'Color turned' pen3||noff||def'.'CR
  3103. SAY 'To make a permanent change, add or delete COLOR from [Y]our userdata item 8.'CR
  3104. RETURN;
  3105.  
  3106.  
  3107. /* ANSI pen color codes */
  3108. colors:
  3109. ARG onoff
  3110. def=''  /* default */
  3111. IF onoff THEN
  3112.   DO
  3113.     pen0='';  pen1='';  pen2='';  pen3='';
  3114.     pen4='';  pen5='';  pen6='';  pen7='';
  3115.     bak0='';  bak1='';  bak2='';  bak3='';
  3116.     bak4='';  bak5='';  bak6='';  bak7='';
  3117.   END
  3118. ELSE
  3119.   DO
  3120.     pen0=''; pen1=''; pen2=''; pen3=''; pen4=''; pen5=''; pen6=''; pen7='';
  3121.     bak0=''; bak1=''; bak2=''; bak3=''; bak4=''; bak5=''; bak6=''; bak7=''
  3122.   END
  3123. RETURN;
  3124.  
  3125.  
  3126. chpro:
  3127. arg=UPPER(LEFT(arg,1))
  3128. IF(arg='') THEN
  3129.   DO  /* show protocol menu */
  3130.     SAY CR
  3131.     SAY '[W]- WXModem'CR
  3132.     SAY '[X]- XModem-CRC'CR
  3133.     SAY '[K]- XModem-1K'CR
  3134.     SAY '[Y]- YModem'CR
  3135.     SAY '[G]- YModem-G'CR
  3136.     SAY '[Z]- ZModem'CR
  3137.     SAY CR
  3138.     arg=getinput(1 0 protocol '> ');
  3139.  END
  3140. Set arg
  3141. Status Transfer
  3142. protocol = RESULT
  3143. SAY protocol||CR
  3144. RETURN;
  3145.  
  3146.  
  3147. viewtext:
  3148. IF arg='' THEN PARSE PULL arg   /* no filename given */
  3149. IF arg='' THEN RETURN;
  3150. IF level<99 THEN
  3151.   arg=COMPRESS(arg,' :/*#?') /* no wildcards, no devs, no dirs allowed */
  3152. IF findfiles(arg) THEN RETURN;
  3153. CALL showtext(arg);
  3154. nonstop=0
  3155. RETURN;
  3156.  
  3157.  
  3158. information:
  3159. infolist=SHOWDIR(bbspath'Information')
  3160. IF infolist='' THEN
  3161.   DO
  3162.     SAY CR
  3163.     SAY pen3'No files in' bbspath'Information drawer!'def||CR
  3164.     SAY CR
  3165.     RETURN;
  3166.   END
  3167. SAY pen3'These text files are available for reading online...'def||CR
  3168. IF ~DATATYPE(sortinfo.0,'N') THEN
  3169.   DO
  3170.     info.=''
  3171.     info.0=WORDS(infolist)
  3172.     DO i=1 TO info.0
  3173.       info.i=WORD(infolist,i)
  3174.     END
  3175.     SAY 'Sorting..'CR
  3176.     CALL QSORT(1,info.0,info)
  3177.     SAY lineup'         'lineup||CR
  3178.     sortinfo.=''
  3179.     sortinfo.0=info.0%3
  3180.     IF (info.0//3)>0 THEN sortinfo.0=sortinfo.0+1
  3181.     DO i=1 TO sortinfo.0
  3182.       sortinfo.i=''
  3183.       DO j=0 TO 2
  3184.         k=i+j*sortinfo.0
  3185.         IF k<=info.0 THEN sortinfo.i=sortinfo.i RIGHT(k,3)'.' LEFT(info.k,20)
  3186.       END
  3187.     END
  3188.   END
  3189. DO FOREVER
  3190.   SAY pen3||LEFT('-',75,'-')||def||CR
  3191.   DO i=1 TO sortinfo.0
  3192.     SAY sortinfo.i||CR
  3193.   END
  3194.   CALL checktime();
  3195.   num=getinput(1 0 pen3'Select Number Of Information File To View> 'def);
  3196.   IF ~DATATYPE(num,'N') | num<1 | num>info.0 THEN RETURN;
  3197.   CALL readlines(bbspath'Information/'info.num 1);
  3198.   CALL seelines();
  3199.   IF waitchar~='Q' THEN CALL waiting();
  3200.   nonstop=0
  3201. END
  3202. RETURN;
  3203.  
  3204.  
  3205. newfiles:
  3206. SAY CR
  3207. SAY 'Searching for new (un-browsed) files since' DATE(,WORD(data.16,2),'S') 'at' WORD(data.16,3)'...'CR
  3208. SAY pen3' - Use CTRL-E to Exit -'def||CR
  3209. lastbrowz=WORD(data.16,1)
  3210. lastfileup=countcheck(bbspath'Numbers/LastFile' 0)
  3211. j=0
  3212. DO ni=lastfileup TO lastbrowz+1 BY -1
  3213.   IF files.ni~='' THEN
  3214.     DO
  3215.       DO ii=level+1 TO sysoplevel
  3216.         IF UPPER(dirs.ii)=UPPER(WORD(files.ni,1)) THEN ITERATE ni /* unauthorized */
  3217.       END
  3218.       j=j+1
  3219.       SAY RIGHT(ni,4)'.' LEFT(WORD(files.ni,2),20) pen3':'WORD(files.ni,1)||def||CR
  3220.       IF j//linesperpage=0 THEN CALL waiting();
  3221.     END
  3222. END
  3223. IF j//linesperpage~=0 THEN CALL waiting();
  3224. CALL newinfo(1);
  3225. IF j>0 THEN
  3226.   DO
  3227.     SAY ' - To reset the ['pen3'N'def']ew files date, you must ['pen3'B'def']rowse at least one file. -'CR
  3228.     SAY '      - Use the ['pen3'B'def']rowse command to see file descriptions. -'CR
  3229.     CALL waiting();
  3230.   END
  3231. ELSE SAY 'No new files found in the libraries.'CR
  3232. nonstop=0
  3233. RETURN;
  3234.  
  3235.  
  3236. newinfo:
  3237. ARG startinfo .
  3238. IF startinfo=1 THEN
  3239.   DO
  3240.     lynes.=''
  3241.     lynes.0=0
  3242.   END
  3243. IF WORD(STATEF(bbspath'Information'),5)>lastondate THEN
  3244.   DO
  3245.     lynes.startinfo=pen1||bak2' New or Updated Information Files. Enter'def pen3'I'def bak2'from the main menu to read 'def
  3246.     dm=DATE(,WORD(data.16,2),'S')
  3247.     PARSE VAR dm da' 'mo' 'yr .
  3248.     yr=RIGHT(yr,2)
  3249.     sincedate=da'-'mo'-'yr
  3250.     ADDRESS COMMAND 'LIST >ram:dirlist' bbspath'Information NOHEAD DATES SINCE' sincedate
  3251.     CALL readlines('ram:dirlist' startinfo+1);
  3252.   END
  3253. IF lynes.0>0 THEN CALL seelines();
  3254. nonstop=0
  3255. RETURN;
  3256.  
  3257.  
  3258. areaselect:
  3259. SAY pen3||LEFT('-',75,'-')||def||CR
  3260. DO i=1 TO msgs.0
  3261.   SAY msgs.i||CR
  3262. END
  3263. temp=getinput(1 0 pen3'Select Message Conference: 'def);
  3264. IF ~DATATYPE(temp,'N') | temp<1 | temp>level | FIND(data.21,temp)>0 THEN RETURN(1);
  3265. msgdir=temp
  3266. RETURN(0);
  3267.  
  3268.  
  3269. chdir:
  3270. string=''
  3271. SAY pen3||LEFT('-',75,'-')||def||CR
  3272. DO i=1 TO libs.0
  3273.   SAY libs.i||CR
  3274. END
  3275. dirnum=getinput(1 0 pen3'Select Library Number: 'def);
  3276. IF ~DATATYPE(dirnum,'N') THEN
  3277.   DO
  3278.     waitchar=dirnum
  3279.     RETURN(2);
  3280.   END
  3281.  
  3282. chdir2:
  3283. IF dirnum<1 | dirnum>99 THEN
  3284.   DO
  3285.     waitchar=dirnum
  3286.     RETURN(1);
  3287.   END
  3288. IF dirs.dirnum='' THEN
  3289.   DO
  3290.     SAY pen3'That library number in currently un-assigned.'def||CR
  3291.     RETURN(1);
  3292.   END
  3293. IF dirnum>level | FIND(data.21,UPPER(dirs.dirnum))>0 THEN
  3294.   DO
  3295.     SAY pen3'You do not have authorization for that library!'def||CR
  3296.     RETURN(1);
  3297.   END
  3298. IF dirs.dirnum~='' THEN
  3299.   DO
  3300.     CALL MAKEDIR(libpath||dirs.dirnum)
  3301.     CALL setdir(libpath||dirs.dirnum)
  3302.   END
  3303. RETURN(0);
  3304.  
  3305.  
  3306. since:
  3307. IF WORDS(data.16)<3 THEN data.16='0 19900101 00:00:00'
  3308. dm=DATE(,WORD(data.16,2),'S')
  3309. SAY CR
  3310. SAY 'New files since' dm||CR
  3311. CALL listsince('')
  3312. CALL readlines('RAM:dirlist' 1)
  3313. CALL seelines();
  3314. nonstop=0
  3315. CALL waiting();
  3316. RETURN;
  3317.  
  3318.  
  3319. listsince:
  3320. ARG listarg
  3321. IF WORDS(data.16)<3 THEN data.16='0 19900101 00:00:00'
  3322. dm=DATE(,WORD(data.16,2),'S')
  3323. PARSE VAR dm da' 'mo' 'yr .
  3324. yr=RIGHT(yr,2)
  3325. sincedate=da'-'mo'-'yr
  3326. ADDRESS COMMAND list '>RAM:dirlist' directory listarg 'DATES SINCE' sincedate
  3327. RETURN;
  3328.  
  3329.  
  3330. list:
  3331. onetime=0
  3332. IF DATATYPE(arg,'N') THEN onetime=1
  3333. ELSE arg=''
  3334. DO listloop=1
  3335.   IF DATATYPE(arg,'N') THEN
  3336.     DO
  3337.       dirnum=arg
  3338.       arg=''
  3339.       IF chdir2()>0 THEN RETURN;
  3340.     END
  3341.   ELSE IF arg~='' THEN RETURN;
  3342.   ELSE IF chdir()>0 THEN RETURN;
  3343.   CALL listsimple();
  3344.   IF waitchar~='' THEN RETURN;
  3345.   IF onetime THEN LEAVE listloop
  3346. END
  3347. RETURN;
  3348.  
  3349.  
  3350. listsimple:
  3351. ADDRESS COMMAND list '>RAM:dirlist' directory 'DATES'
  3352. IF readlines('RAM:dirlist' 1) THEN RETURN;
  3353. IF lynes.0>3 THEN
  3354.   DO
  3355.     SAY pen3'Sorting...'def||lineup||CR
  3356.     linesave=lynes.1  /* these 4 lines put in to leave dir title at top */
  3357.     lynes.1='0'
  3358.     CALL QSORT(1,lynes.0-1,lynes)
  3359.     CALL DELAY(14)
  3360.     lynes.1=linesave
  3361.   END
  3362. CALL seelines();
  3363. nonstop=0
  3364. CALL waiting();
  3365. RETURN;
  3366.  
  3367.  
  3368. browse:
  3369. curdironly=0
  3370. brdir=PRAGMA('D')
  3371. brfilenum=1
  3372. IF files.0<1 THEN RETURN;
  3373. IF arg='' THEN
  3374.   DO
  3375.     line='Browsing'
  3376.     test=getinput(1 1 'Browse the' pen3||plaindir||def 'library only? (yN) > ')
  3377.     IF test='Y' THEN
  3378.       DO
  3379.         curdironly=1
  3380.         line=line 'the' pen3||plaindir||def 'library'
  3381.       END
  3382.     ELSE line=line 'all file libraries'
  3383.     line=line 'backwards from latest file.'
  3384.     SAY line||CR
  3385.   END
  3386. lastfilenum=countcheck(bbspath'Numbers/LastFile' 0)
  3387. IF lastfilenum<1 THEN RETURN;
  3388. i=0
  3389. IF arg='' | UPPER(arg)='NEW' | UPPER(arg)='ALL' THEN
  3390.   DO
  3391.     arg=WORD(files.lastfilenum,2)
  3392.     IF arg='' THEN RETURN;
  3393.     brfilenum=lastfilenum
  3394.   END
  3395. ELSE IF DATATYPE(arg,'N') & files.arg~='' THEN
  3396.   DO
  3397.     brfilenum=arg
  3398.     arg=WORD(files.arg,2)
  3399.   END
  3400. ELSE
  3401.   DO
  3402.     DO i=1 TO lastfilenum+1
  3403.       IF UPPER(WORD(files.i,2))~=UPPER(arg) THEN ITERATE i
  3404.       brfilenum=i
  3405.       LEAVE i
  3406.     END
  3407.     IF i>lastfilenum THEN
  3408.       DO
  3409.         SAY 'Unable to find a file description for' pen3||arg||def'.'CR
  3410.         RETURN;
  3411.       END
  3412.   END
  3413. CALL setdir(libpath||WORD(files.brfilenum,1))
  3414. savearg=arg
  3415. IF brfilenum>lastfilenum THEN brfilenum=lastfilenum
  3416. newfilesdate=DATE('S') TIME()
  3417. DO browseloop=1
  3418.   DO i=brfilenum TO 0 BY -1
  3419.     IF files.i='' THEN ITERATE i
  3420.     testdir=UPPER(WORD(files.i,1))
  3421.     IF curdironly & UPPER(brdir)~=libpath||UPPER(testdir) THEN
  3422.       DO
  3423.         IF i>lastbrowse THEN lastbrowse=i
  3424.         ITERATE i
  3425.       END
  3426.     IF FIND(data.21,testdir)>0 | finddirnum(testdir)>level THEN
  3427.       DO
  3428.         IF i>lastbrowse THEN lastbrowse=i
  3429.         ITERATE i
  3430.       END
  3431.     LEAVE i
  3432.   END
  3433.   IF i=0 THEN brfilenum=lastbrowse;
  3434.   ELSE brfilenum=i
  3435.   argname=WORD(files.i,2)
  3436.   IF argname='' THEN RETURN;
  3437.   CALL setdir(libpath||WORD(files.i,1))
  3438.   arg=bbspath'FileNotes/'plaindir'/'argname
  3439.   CALL readlines(arg 1);
  3440.   IF nonstop=1 THEN brostop=1
  3441.   ELSE brostop=0
  3442.   CALL seelines();
  3443.   IF brfilenum>lastbrowse THEN lastbrowse=brfilenum
  3444.   CALL checktime();
  3445.   IF brostop THEN
  3446.     DO
  3447.       SAY CR
  3448.       nonstop=1
  3449.       brfilenum=brfilenum-1
  3450.     END
  3451.   ELSE
  3452.     DO
  3453.       line=''
  3454.       endtest=UPPER(RIGHT(argname,4))
  3455.       line='['pen3'C'def']ontents ['pen3'D'def']ownload'
  3456.       line=line '['pen3'H'def']elp ['pen3'N'def']on-Stop'
  3457.       IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3458.         line=line '['pen3'E'def']dit ['pen3'K'def']ill'
  3459.       IF level>sysoplevel THEN line=line '['pen3'M'def']ove'
  3460.       line=line '['pen3'Q'def']uit > '
  3461.       brcom=getinput(1 0 line);
  3462.       IF DATATYPE(brcom,'N') THEN
  3463.         DO
  3464.           brfilenum=brcom+1
  3465.           SAY CR
  3466.         END
  3467.       ELSE brcom=LEFT(brcom,1)
  3468.       CALL cleanline(0);
  3469.       CALL checktime();
  3470.       IF brcom='Q' THEN LEAVE browseloop
  3471.       ELSE IF brcom='H' THEN
  3472.         DO
  3473.           SAY pen3' - HELP with the Browse Files commands -'def||CR
  3474.           SAY ' RETURN reads the next file description in line.'CR
  3475.           SAY ' 34 will display the description of file number 34, if it exists.'CR
  3476.           SAY ' C  displays the contents of an archived (lzh|arc|zoo|zip) file.'CR
  3477.           SAY ' D  starts sending this file to you using the current protocol.'CR
  3478.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3479.             DO
  3480.           SAY ' E  puts this file description into the online Editor.'CR
  3481.           SAY ' K  deletes a file you uploaded. you cannot Kill others!'CR
  3482.             END
  3483.           IF level>sysoplevel THEN
  3484.           SAY ' M  move file and description to new library.'CR
  3485.           SAY ' N  displays all descriptions without pausing. CTRL-E to Exit!'CR
  3486.           SAY ' Q  returns to the main menu(s). (Quit)'CR
  3487.           SAY CR
  3488.           CALL waiting();
  3489.           IF waitchar='Q' THEN LEAVE browseloop
  3490.         END
  3491.       ELSE IF brcom='M' THEN
  3492.         DO
  3493.           mvdir=getinput(0 0 'Move' argname 'to library (name|number) ')
  3494.           IF mvdir~='' THEN
  3495.             DO
  3496.               IF DATATYPE(mvdir,'N') THEN
  3497.                 DO
  3498.                   dirnum=mvdir
  3499.                   IF chdir2()=0 THEN
  3500.                     CALL movefile(brfilenum dirs.dirnum);
  3501.                 END
  3502.               ELSE
  3503.                 DO
  3504.                   mvdir=STRIP(mvdir)
  3505.                   DO mj=1 TO level+1
  3506.                     IF UPPER(mvdir)=UPPER(dirs.mj) THEN LEAVE mj
  3507.                   END
  3508.                   IF mj<=level THEN CALL movefile(brfilenum mvdir)
  3509.                 END
  3510.             END
  3511.         END
  3512.       ELSE IF brcom='N' THEN
  3513.         DO
  3514.           brfilenum=brfilenum-1
  3515.           nonstop=1
  3516.           SAY pen3'To EXIT non-stop scrolling of text, press CTRL-E'def||CR
  3517.           SAY CR
  3518.           brcom=''
  3519.         END
  3520.       ELSE IF brcom='C' THEN
  3521.         DO
  3522.           arcomm='lharc'
  3523.           IF endtest='.ARC' THEN arcomm='arc'
  3524.           IF endtest='.ZOO' THEN arcomm='zoo'
  3525.           IF endtest='.ZIP' THEN
  3526.                ADDRESS COMMAND 'unzip >ram:CONTENTS -v' argname
  3527.           ELSE ADDRESS COMMAND arcomm '>ram:CONTENTS v' argname
  3528.           CALL readlines('RAM:CONTENTS' 1)
  3529.           CALL seelines();
  3530.           CALL waiting();
  3531.           nonstop=0
  3532.         END
  3533.       ELSE IF brcom='D' THEN
  3534.         DO
  3535.           arg2=arg
  3536.           arg=argname
  3537.           CALL dload();
  3538.           arg=arg2
  3539.         END
  3540.       ELSE IF brcom='E' THEN
  3541.         DO
  3542.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3543.             DO
  3544.               firstedit=5
  3545.               IF level>sysoplevel THEN firstedit=1
  3546.               CALL bbsED(firstedit arg);
  3547.             END
  3548.         END
  3549.       ELSE IF brcom='K' THEN
  3550.         DO
  3551.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3552.             DO
  3553.               IF getinput(1 1 pen3'Do you really want to kill this file? (nY) >'def)~='N' THEN
  3554.                 DO
  3555.                   tempnum=WORD(lynes.1,2)
  3556.                   files.tempnum=''
  3557.                   CALL savefilelist();
  3558.                   CALL DELETE(argname)
  3559.                   CALL DELETE(arg)
  3560.                   SAY argname pen3'has been deleted.'def||CR
  3561.                 END
  3562.             END
  3563.         END
  3564.       ELSE brfilenum=brfilenum-1
  3565.     END
  3566. END
  3567. CALL setdir(brdir)
  3568. waitchar=''
  3569. IF nonstop THEN CALL waiting();
  3570. nonstop=0
  3571. CALL savedata(0);
  3572. RETURN;
  3573.  
  3574.  
  3575. movefile:
  3576. PARSE ARG fnum movdir .
  3577. fdir=STRIP(WORD(files.fnum,1))
  3578. farg=STRIP(WORD(files.fnum,2))
  3579. CALL MAKEDIR(libpath||movdir)
  3580. ADDRESS COMMAND 'COPY' libpath||fdir'/'farg libpath||movdir
  3581. IF EXISTS(libpath||fdir'/'farg) THEN CALL DELETE(libpath||fdir'/'farg)
  3582. files.fnum=movdir farg
  3583. lynes.3=DELWORD(lynes.3,WORDS(lynes.3),1)
  3584. lynes.3=STRIP(lynes.3) movdir
  3585. CALL MAKEDIR(bbspath'FileNotes/'movdir)
  3586. CALL savelines(bbspath'FileNotes/'movdir'/'farg);
  3587. CALL savefilelist();
  3588. CALL DELETE(bbspath'FileNotes/'fdir'/'farg)
  3589. line='Moved:' fdir'/'farg 'to' movdir
  3590. CALL send2log(line);
  3591. SAY line||CR
  3592. RETURN;
  3593.  
  3594.  
  3595. textsearch:
  3596. PARSE ARG sfile sarg
  3597. x=OPEN(f,sfile,'R')
  3598. IF x=0 THEN RETURN(0);
  3599. sarg=UPPER(sarg)
  3600. stemp=UPPER(READCH(f,65000))
  3601. CALL CLOSE(f)
  3602. IF POS(sarg,stemp)>0 THEN RETURN(1);
  3603. RETURN(0);
  3604.  
  3605.  
  3606. bbsSEARCH:
  3607. IF menu='ALL' THEN
  3608.   DO
  3609.     junk=getinput(1 1 'Search ['pen3'F'def']iles ['pen3'M'def']essages or ['pen3'U'def']sers > ')
  3610.     IF junk='F' THEN smenu='FILE'
  3611.     ELSE IF junk='M' THEN smenu='MSG'
  3612.     ELSE IF junk='U' THEN smenu='MAIN'
  3613.     ELSE RETURN;
  3614.   END
  3615. ELSE smenu=menu
  3616. searcharg=''
  3617. searcharg=getinput(0 0 pen3'Search Phrase: 'def)
  3618. IF LENGTH(STRIP(searcharg))=0 THEN RETURN;
  3619. searcharg=COMPRESS(searcharg,'*')
  3620. CALL send2log('SEARCH:' smenu 'for' searcharg);
  3621. lynes.=''
  3622. lynes.0=1
  3623. IF smenu='NEW' | smenu='MAIN' THEN
  3624.   DO
  3625.     SAY 'Searching Userlist...'CR
  3626.     lynes.1='These user names matched' searcharg'.'
  3627.     DO i=1 TO WORDS(userlist)
  3628.       IF POS(UPPER(searcharg),UPPER(WORD(userlist,i)))>0 THEN
  3629.         DO
  3630.           count=lynes.0+1
  3631.           lynes.count=WORD(userlist,i)
  3632.           lynes.0=count
  3633.         END
  3634.     END
  3635.   END
  3636. IF smenu='MSG' THEN
  3637.   DO
  3638.     SAY 'Searching Message Conferences...'CR
  3639.     lynes.1=searcharg 'was found in these messages.'
  3640.     DO msgdir=1 TO level
  3641.       IF msgdir>level THEN LEAVE msgdir
  3642.       IF msg.msgdir='' | FIND(data.21,msgdir)>0 THEN ITERATE msgdir
  3643.       msglist=SHOWDIR(msgpath||msgdir)
  3644.       IF WORDS(msglist)>0 THEN SAY lineup||RIGHT(msg.msgdir,40)||CR
  3645.       DO i=1 TO WORDS(msglist)
  3646.         IF textsearch(msgpath||msgdir'/'WORD(msglist,i) searcharg) THEN
  3647.           DO
  3648.             count=lynes.0+1
  3649.             lynes.count='MSG:' RIGHT(WORD(msglist,i),5) 'in' msg.msgdir
  3650.             lynes.0=count
  3651.           END
  3652.       END
  3653.     END
  3654.   END
  3655. IF smenu='FILE' THEN
  3656.   DO
  3657.     SAY 'Searching File Descriptions...'CR
  3658.     lynes.1=searcharg 'was found in the Descriptions of these files.'
  3659.     DO i=1 TO countcheck(bbspath'Numbers/LastFile' 0)
  3660.       IF files.i='' THEN ITERATE i
  3661.       testdir=UPPER(WORD(files.i,1))
  3662.       IF FIND(excludelist,testdir)>0 THEN ITERATE i
  3663.       IF finddirnum(testdir)>level THEN ITERATE i
  3664.       farg=WORD(files.i,1)'/'WORD(files.i,2)
  3665.       SAY lineup||RIGHT(farg,40)||CR
  3666.       IF textsearch(bbspath'FileNotes/'farg searcharg) THEN
  3667.         DO
  3668.           SAY lineup||RIGHT(i,5)'.' LEFT(WORD(files.i,2),30) 'Library:' pen3||WORD(files.i,1)||def||CR
  3669.           SAY CR
  3670.         END
  3671.     END
  3672.   END
  3673. CALL cleanline(0);
  3674. IF smenu~='FILE' THEN
  3675.   DO
  3676.     IF lynes.0<2 THEN
  3677.       DO
  3678.         SAY lineup'No matches to' searcharg 'were found.'CR
  3679.         RETURN;
  3680.       END
  3681.     CALL seelines();
  3682.   END
  3683. nonstop=0
  3684. CALL waiting();
  3685. RETURN;
  3686.  
  3687.  
  3688.  
  3689. finddirnum:
  3690. ARG fdirname
  3691. DO fdir=1 TO 99
  3692.   IF UPPER(dirs.fdir)=fdirname THEN RETURN(fdir);
  3693. END
  3694. RETURN(100);
  3695.  
  3696.  
  3697. writebuffer:
  3698. PARSE ARG bufname .
  3699. CALL DELETE(bufname)
  3700. SAY 'Type 'pen3'/END'def' on a new line to exit.'CR
  3701. CaptWrap 74
  3702. Send pen3
  3703. Capture bufname
  3704. Send def
  3705. DO bufloop=1
  3706.   Timeout 90
  3707.   Wait '/END'
  3708.   Status 'L'
  3709.   IF LENGTH(RESULT)=4 THEN LEAVE bufloop
  3710.   CALL checkdcd();
  3711. END
  3712. Timeout maxidle
  3713. Send '\b\b\b\b'pen3
  3714. Capture OFF
  3715. CALL checkdcd();
  3716. Queue def||CR
  3717. IF bufname=scratch'/EditorFile' THEN startnum=lynes.0+1
  3718. ELSE IF bufname=scratch'/MessageFile' THEN startnum=7
  3719. ELSE IF bufname=scratch'/NoteFile' THEN startnum=5
  3720. ELSE startnum=1
  3721. CALL readlines(bufname startnum);
  3722. CALL wrapbuf(startnum)
  3723. RETURN;
  3724.  
  3725.  
  3726. wrapbuf:
  3727. CALL cleanline(1);
  3728. SAY pen3'Wordwrapping...'def||CR
  3729. ARG startnum .
  3730. lynes.startnum=COMPRESS(lynes.startnum,'0C'x)  /* no FF */
  3731. DO wi=startnum WHILE wi<=lynes.0
  3732.   wj=wi+1
  3733.   lynes.wj=COMPRESS(lynes.wj,'08'x||'0C'x||'7F'x)
  3734.   tabpos=POS('09'x,lynes.wi)
  3735.   DO WHILE tabpos>0
  3736.     lynes.wi=DELSTR(lynes.wi,tabpos,1)
  3737.     lynes.wi=INSERT('  ',lynes.wi,tabpos-1)
  3738.     tabpos=POS('09'x,lynes.wi)
  3739.   END
  3740.   IF LENGTH(lynes.wi)>78 & WORDS(lynes.wi)>1 THEN
  3741.     DO
  3742.       testchar=''
  3743.       IF lynes.wj~='' THEN testchar=LEFT(lynes.wj,1)
  3744.       IF testchar=' ' | testchar='.' | testchar='09'x THEN
  3745.         DO
  3746.           DO wj=lynes.0 TO wi+1 BY -1
  3747.             wk=wj+1
  3748.             lynes.wk=lynes.wj
  3749.           END
  3750.           wj=wi+1
  3751.           lynes.wj=''
  3752.           lynes.0=lynes.0+1
  3753.         END
  3754.       DO wl=WORDS(lynes.wi) TO 1 BY -1 WHILE LENGTH(lynes.wi)>74
  3755.         lynes.wj=WORD(lynes.wi,wl) lynes.wj
  3756.         lynes.wi=STRIP(DELWORD(lynes.wi,wl,1))
  3757.       END
  3758.     END
  3759. END
  3760. RETURN;
  3761.  
  3762.  
  3763. seelines:
  3764. DO i=1 TO lynes.0
  3765.   IF LEFT(lynes.i,2)=': ' THEN SAY pen2||lynes.i||def||CR
  3766.   ELSE IF LEFT(lynes.i,10)='Directory ' | LEFT(lynes.i,5)='=====' THEN
  3767.     SAY pen3||lynes.i||def||CR
  3768.   ELSE SAY lynes.i||CR
  3769.   IF i//linesperpage=0 & nonstop~=1 THEN
  3770.     DO
  3771.       waitchar=getinput(1 1 pen3'   Q=Quit   N=Non-Stop   RETURN=Continue   'def);
  3772.       IF waitchar='N' THEN
  3773.         DO
  3774.           nonstop=1
  3775.           SAY lineup||pen3'To EXIT non-stop scrolling of text, press CTRL-E        'def||CR
  3776.           SAY CR
  3777.           waitchar=''
  3778.         END
  3779.       IF waitchar='Q' THEN LEAVE i
  3780.       CALL cleanline(1);
  3781.       CALL checktime();
  3782.     END
  3783. END
  3784. nonstop=0
  3785. RETURN;
  3786.  
  3787.  
  3788. readlines:
  3789. CALL CLOSE(f)
  3790. PARSE ARG tempname readstart .
  3791. IF ~readopen(tempname) THEN RETURN(1);
  3792. IF readstart<2 THEN lynes.=''
  3793. DO ri=readstart
  3794.   line=READLN(f)
  3795.   IF EOF(f) THEN BREAK;
  3796.   lynes.ri=line
  3797. END
  3798. lynes.0=ri-1
  3799. CALL CLOSE(f)
  3800. DO ri=lynes.0 TO 0 BY -1 WHILE LENGTH(lynes.ri)=0 | UPPER(lynes.ri)='/END'
  3801. END
  3802. lynes.0=ri
  3803. RETURN(0);
  3804.  
  3805.  
  3806. savelines:
  3807. PARSE ARG tempname .
  3808. IF EXISTS(tempname) & edtype='MAIL' THEN
  3809.   DO
  3810.     ok=OPEN(f,tempname,'A')
  3811.     IF ok~=0 THEN CALL WRITELN(f,INSERT('','',1,75,'^'))
  3812.   END
  3813. ELSE ok=OPEN(f,tempname,'W')
  3814. IF ok=0 THEN
  3815.   DO
  3816.     line='***' tempname 'failed to open for saving!'
  3817.     CALL send2log(line)
  3818.     SAY line||CR
  3819.     RETURN(1);
  3820.   END
  3821. DO wi=1 TO lynes.0
  3822.   CALL WRITELN(f,lynes.wi)
  3823. END
  3824. CALL CLOSE(f)
  3825. RETURN(0);
  3826.  
  3827.  
  3828. loaduserlist:
  3829. userlist=SHOWDIR(bbspath'Users')
  3830. ulynes.=''
  3831. IF ~EXISTS(bbspath'Lists/USERS') THEN CALL sortuserlist();
  3832. ELSE IF readopen(bbspath'Lists/USERS') THEN
  3833.   DO
  3834.     DO i=1
  3835.       line=READLN(f)
  3836.       IF EOF(f) THEN BREAK;
  3837.       ulynes.i=line
  3838.     END
  3839.     ulynes.0=i-1
  3840.     CALL CLOSE(f)
  3841.   END
  3842. RETURN;
  3843.  
  3844.  
  3845. saveuserlist:
  3846. IF writeopen(bbspath'Lists/USERS') THEN
  3847.   DO
  3848.     DO i=1 TO ulynes.0
  3849.       CALL WRITELN(f,ulynes.i)
  3850.     END
  3851.     CALL CLOSE(f)
  3852.   END
  3853. RETURN;
  3854.  
  3855.  
  3856. sortuserlist:
  3857. SAY 'Rebuilding Userlist...'CR
  3858. userlist=SHOWDIR(bbspath'Users')
  3859. user.=''
  3860. users=WORDS(userlist)
  3861. user.0=users
  3862. DO uli=1 TO users
  3863.   user.uli=WORD(userlist,uli)
  3864.   uscore=LASTPOS('_',user.uli)
  3865.   IF uscore>0 THEN user.uli=SUBSTR(user.uli,uscore+1)'@'LEFT(user.uli,uscore-1)
  3866. END
  3867. CALL QSORT(1,users,user)
  3868. DO uli=1 TO users
  3869.   uscore=POS('@',user.uli)
  3870.   IF uscore>0 THEN user.uli=SUBSTR(user.uli,uscore+1)'_'LEFT(user.uli,uscore-1)
  3871. END
  3872. ulynes.=''
  3873. ulynes.0=user.0%3
  3874. IF (user.0//3)>0 THEN ulynes.0=ulynes.0+1
  3875. DO i=1 TO ulynes.0
  3876.   ulynes.i=LEFT(user.i,25)
  3877.   DO j=1 TO 2
  3878.     k=i+j*ulynes.0
  3879.     IF k<=users THEN ulynes.i=ulynes.i' 'LEFT(user.k,25)
  3880.   END
  3881. END
  3882. CALL saveuserlist();
  3883. RETURN;
  3884.  
  3885.  
  3886. showuserlist:
  3887. IF data.5='' THEN line='Here are the EMail names of your fellow users.'
  3888. ELSE line='   'WORDS(userlist) 'users. Use these names to address messages.'
  3889. SAY pen3||line||def||CR
  3890. DO uli=1 TO ulynes.0
  3891.   SAY ulynes.uli||CR
  3892.   IF uli//linesperpage=0 & uli<ulynes.0 THEN CALL waiting();
  3893.   IF waitchar='Q' THEN RETURN;
  3894. END
  3895. IF data.5~='' THEN CALL waiting();
  3896. RETURN;
  3897.  
  3898.  
  3899. msgcount:
  3900. ARG countdir .
  3901. lastmess=0
  3902. IF ~EXISTS(msgpath||countdir) THEN RETURN;
  3903. lastread.countdir=WORD(data.22,countdir)
  3904. IF ~DATATYPE(lastread.countdir,'N') THEN lastread.countdir=0
  3905. IF lastread.countdir<0 THEN RETURN;
  3906. lastmess=countcheck(bbspath'Numbers/LastMessage'countdir 0)
  3907. firstmess=countcheck(bbspath'Numbers/FirstMessage'countdir 0)
  3908. IF lastread.countdir<firstmess THEN lastread.countdir=firstmess-1
  3909. IF DATATYPE(msg.countdir.0,'N') THEN totmsgs=msg.countdir.0
  3910. totmsgs=lastmess
  3911. msg.countdir.0=totmsgs
  3912. IF totmsgs<(lastmess-lastread.countdir) THEN totmsgs=lastmess-lastread.countdir
  3913. IF lastmess>0 THEN
  3914.   IF lastread.countdir>=0 & ~logonflag THEN
  3915.     DO
  3916.       cline=RIGHT(lastmess-lastread.countdir,6) 'unread of' RIGHT(totmsgs,6)
  3917.       cline=cline 'messages in the 'CENTER(msg.countdir,20)' conference.'
  3918.       SAY pen6||cline||def||CR
  3919.     END
  3920. RETURN;
  3921.  
  3922.  
  3923. counts:
  3924. cmin=countcheck(bbspath'Numbers/Minutes' 0)
  3925. chr=cmin%60
  3926. cmin=cmin//60
  3927. SAY CR
  3928. SAY 'Total Connect Time Since First Logon [all users]:' chr 'hours' cmin 'minutes.'CR
  3929. prevcaller=GETCLIP('BBS_prevcaller')
  3930. IF prevcaller~='' THEN
  3931.   DO
  3932.     SAY CR
  3933.     SAY 'The previous BBS user was' prevcaller||CR
  3934.     IF level>sysoplevel THEN
  3935.       DO
  3936.         SAY '  logged off at:' GETCLIP('BBS_userlogoff')||CR
  3937.         SAY pen3'Last disconnect:'def GETCLIP('BBS_disconnect')||CR
  3938.       END
  3939.   END
  3940. ds=DATE()
  3941. ds=WORD(ds,2)||WORD(ds,3)
  3942. usageclip=GETCLIP('BBS_totalusage')
  3943. IF usageclip='' THEN CALL bbsUSAGE.baud(ds)
  3944. ELSE
  3945.   DO
  3946.     SAY CR
  3947.     SAY 'Total BBS Usage For' DATE('M') WORD(DATE(),3)':' WORD(usageclip,1) 'hours' WORD(usageclip,2) 'minutes.'CR
  3948.   END
  3949. CALL bbsspace();
  3950. SAY RIGHT(countcheck(bbspath'Numbers/Calls' 0),19)'  completed calls.'CR
  3951. SAY RIGHT(countcheck(bbspath'Numbers/LastMail' 0),19)'  private messages.'CR
  3952. totmsg=0
  3953. DO conf=1 TO 99
  3954.   IF msg.conf~='' THEN totmsg=totmsg+countcheck(bbspath'Numbers/LastMessage'conf 0)
  3955. END
  3956. SAY RIGHT(totmsg,19)'  public messages.'CR
  3957. SAY RIGHT(files.0,19)'  public files.'CR
  3958. SAY RIGHT(WORDS(userlist),19)'  users.'CR
  3959. SAY CR
  3960. SAY '  You Have'CR
  3961. totmail=WORD(data.17,2)
  3962. IF ~DATATYPE(totmail,'N') THEN totmail=0
  3963. totmsg=0
  3964. DO ti=1 TO level
  3965.   temp=WORD(data.23,ti)
  3966.   IF DATATYPE(temp,'N') THEN totmsg=totmsg+WORD(data.23,ti)
  3967. END
  3968. SAY '   Written' RIGHT(totmsg,8) 'public &' RIGHT(totmail,4) 'private  messages.'CR
  3969. totfiles=WORD(data.14,1)
  3970. IF ~DATATYPE(totfiles,'N') THEN totfiles=0
  3971. totbytes=WORD(data.14,3)
  3972. IF ~DATATYPE(totbytes,'N') THEN totbytes=0
  3973. SAY '  Uploaded' RIGHT(totbytes,8) 'bytes in' RIGHT(totfiles,4) 'files.'CR
  3974. totfiles=WORD(data.15,1)
  3975. IF ~DATATYPE(totfiles,'N') THEN totfiles=0
  3976. totbytes=WORD(data.15,3)
  3977. IF ~DATATYPE(totbytes,'N') THEN totbytes=0
  3978. SAY 'Downloaded' RIGHT(totbytes,8) 'bytes in' RIGHT(totfiles,4) 'files.'CR
  3979. SAY '..and been on' bbsname data.19||CR
  3980. SAY CR
  3981. CALL waiting();
  3982. CALL showmarked();
  3983. CALL logonstats();
  3984. CALL waiting();
  3985. RETURN;
  3986.  
  3987.  
  3988. logonstats:
  3989. IF level=0 THEN RETURN;
  3990. SAY bak2||name||def 'Last on' DATE('W',lastondate,'I') DATE(,lastondate,'I')||CR
  3991. lastbrowse=WORD(data.16,1)
  3992. IF ~DATATYPE(lastbrowse,'N') THEN lastbrowse=0
  3993. tempnum=countcheck(bbspath'Numbers/LastFile' 0)-lastbrowse
  3994. IF tempnum>files.0 THEN tempnum=files.0
  3995. IF tempnum>0 THEN SAY pen6||RIGHT(tempnum,6) 'new of' RIGHT(files.0,6) 'files.'def||CR
  3996. ELSE SAY 'No new files.'CR
  3997. totmsg=0
  3998. grand=0
  3999. DO i=1 TO level
  4000.   IF msg.i='' | FIND(data.21,i)>0 THEN ITERATE i
  4001.   CALL msgcount(i)
  4002.   totmsg=totmsg+lastmess-lastread.i
  4003.   grand=grand+lastmess
  4004. END
  4005. IF totmsg>0 THEN SAY pen6||RIGHT(totmsg,6) 'new of' RIGHT(grand,6) 'messages.'def||CR
  4006. ELSE SAY 'No new messages.'CR
  4007. IF GETCLIP('BBS_screen')~=0 THEN
  4008.   SAY pen3'You may experience slowdowns when the sysop is also using this Amiga.'def||CR
  4009. ELSE SAY pen3'BBBBS is in fast mode.'def||CR
  4010.  
  4011. callsleft:
  4012. test=WORD(data.11,3)
  4013. IF test<1 THEN
  4014.   line=pen0||bak1' Attention! 'def 'This is your last call for' DATE('W')',' DATE()
  4015. ELSE
  4016.   DO
  4017.     line='You may call' test 'more time'
  4018.     IF test~=1 THEN line=line's'
  4019.     line=line 'today.'
  4020.   END
  4021. SAY line||CR
  4022. RETURN;
  4023.  
  4024.  
  4025. checkdcd:
  4026. dcd
  4027. IF RC=0 THEN
  4028.   DO
  4029.     Beep
  4030.     CALL DELAY(100)
  4031.     dcd
  4032.     IF RC=0 THEN
  4033.       DO
  4034.         CALL SETCLIP('BBS_disconnect',TIME('C') DATE() name)
  4035.         line='^^^^^ LOST CARRIER! ^^^' DATE() TIME() '^^^^^'
  4036.         SAY CR
  4037.         SAY line||CR
  4038.         CALL send2log(line)
  4039.         Beep
  4040.         CALL DELAY(14)
  4041.         Beep
  4042.         IF newpassword='' THEN SIGNAL DONE
  4043.         ELSE SIGNAL OUT
  4044.       END
  4045.   END
  4046. CALL checkexternal();
  4047. RETURN;
  4048.  
  4049.  
  4050. checkexternal:
  4051. xcom=GETCLIP('BBS_COMMAND')
  4052. IF xcom~='' THEN
  4053.   DO
  4054.     CALL SETCLIP('BBS_COMMAND')
  4055.     IF POS('G',xcom)>0 THEN SIGNAL LOGOUT2
  4056.     IF newpassword~='' THEN
  4057.       DO
  4058.         IF POS('M',xcom)>0 THEN CALL validate();
  4059.         IF POS('L',xcom)>0 THEN CALL uplevel();
  4060.         IF POS('T',xcom)>0 THEN CALL uptime();
  4061.         IF POS('R',xcom)>0 THEN CALL upratio();
  4062.       END
  4063.     IF POS('C',xcom)>0 THEN CALL chat();
  4064.   END
  4065. RETURN;
  4066.  
  4067.  
  4068. chat:
  4069. SAY 'Entering chat mode with sysop.'CR
  4070. SAY 'Press [RETURN] twice to tell' sysop 'you are waiting for a response.'CR
  4071. OPTIONS PROMPT ''
  4072. string=''
  4073. DO WHILE(string~='\')
  4074.   PULL string
  4075.   CALL checkdcd();
  4076. END
  4077. RETURN;
  4078.  
  4079.  
  4080. readopen:
  4081. PARSE ARG fname
  4082. ok=OPEN(f,fname,'R')
  4083. IF ok~=0 THEN RETURN(1);
  4084. line=fname 'failed to open for reading!'
  4085. SAY line||CR
  4086. CALL send2log(line)
  4087. RETURN(0);
  4088.  
  4089.  
  4090. writeopen:
  4091. PARSE ARG fname
  4092. CALL CLOSE(f)
  4093. ok=OPEN(f,fname,'W')
  4094. IF ok~=0 THEN RETURN(1);
  4095. line=fname 'failed to open for writing!'
  4096. SAY line||CR
  4097. CALL send2log(line)
  4098. RETURN(0);
  4099.  
  4100.  
  4101. SYNTAX:
  4102. FAILURE:
  4103. lin.1=pen7||ERRORTEXT(RC)||def
  4104. lin.2=SIGL-1     SOURCELINE(SIGL-1)
  4105. lin.3=SIGL pen7||SOURCELINE(SIGL)||def
  4106. lin.4=SIGL+1     SOURCELINE(SIGL+1)
  4107. DO er=1 TO 4
  4108.   IF level>sysoplevel THEN SAY lin.er||CR
  4109.   CALL send2log(lin.er)
  4110. END
  4111. CALL CLOSE(f)
  4112. IF newpassword='' THEN SIGNAL DONE2  /* no user logged on, quit quietly */
  4113. SAY CR
  4114. SAY '*** Oops! The BBS was confused for a moment. The sysop will be notified. ***'CR
  4115. SAY CR
  4116. CALL checkdcd();
  4117. IF level>sysoplevel THEN
  4118.   DO
  4119.     junk=getinput(1 1 'ReStart: (yN) > ');
  4120.     IF junk~='Y' THEN SIGNAL LOGOUT
  4121.   END
  4122. string=''
  4123. waitchar=''
  4124. IF data.1~='' & data.5~='' & data.20~='' THEN CALL savedata(0);
  4125. SIGNAL RESTART
  4126.  
  4127.  
  4128. BREAK_E:
  4129. Queue CR
  4130. CALL CLOSE(f)
  4131. SAY pen3'*** CTRL-E BREAK ***'def||CR
  4132. waitchar=''
  4133. string=''
  4134. nonstop=0
  4135. rnonstop=0
  4136. brostop=0
  4137. i=999999
  4138. ni=0
  4139. RETURN(0);
  4140.  
  4141.  
  4142. BREAK_C:
  4143. CALL CLOSE(f)
  4144. IF newpassword='' THEN
  4145.   DO
  4146.     CALL SETCLIP('BBS_disconnect',TIME('C') DATE() name)
  4147.     SIGNAL DONE2  /* no user logged on, quit quietly */
  4148.   END
  4149. CALL checkdcd();
  4150. Queue CR
  4151. IF warnings<1 THEN  /* just 1 warning */
  4152.   DO
  4153.     warnings=warnings+1
  4154.     SAY 'If you didn''t press CTRL-C then...   HEY!    Wake up!'CR
  4155.     SAY 'Auto-disconnect in' TRUNC(maxidle%60+.5) 'minutes!'CR
  4156.     SAY 'If you DID press CTRL-C, well... never mind!'CR
  4157.     Send '^G\w\w^G\w\w^G\w^G\w^G^G^G^G'
  4158.     waitchar=''
  4159.     string=''
  4160.     nonstop=0
  4161.     SIGNAL RESTART
  4162.   END
  4163. CALL SETCLIP('BBS_disconnect',TIME('C') DATE() name)
  4164. SAY 'Timeout/Carrier loss -- Disconnecting.'CR
  4165. SIGNAL LOGOUT2
  4166.  
  4167. LOGOUT:
  4168. junk=getinput(1 1 pen3'Leave Feedback for SysOp? (yN) > 'def);
  4169. IF junk='Y' THEN
  4170.   DO
  4171.     opt='C'  /* to trigger Feedback as Subject */
  4172.     CALL editor('MAIL' sysop);
  4173.   END
  4174.  
  4175. LOGOUT2:
  4176. CALL callsleft()
  4177. secs=TIME('E')
  4178. mins=secs%60
  4179. secs=TRUNC(secs//60)
  4180. IF secs<10 THEN secs='0'secs
  4181. SAY
  4182. SAY 'Time used this call:' mins':'secs||CR
  4183. SAY 'Goodbye' name', thank you for calling' bbsname'.'CR
  4184. arg = bbspath'BBS_TEXT/GOODBYE'
  4185. IF EXISTS(arg) THEN
  4186.   DO
  4187.     CALL DELAY(14)
  4188.     CALL readlines(arg 1);
  4189.     CALL seelines();
  4190.   END
  4191. SAY CR
  4192. IF bbsprefs.2 THEN CALL doGrin();
  4193. CALL setdir(libpath||dirs.1)
  4194.  
  4195. OUT:
  4196. data.18=winnings
  4197. line=left(name,16,' ') 'logged off at' time('C')
  4198. Remote off
  4199. dcd
  4200. IF(rc~=0) THEN Send '\ah'
  4201. IF data.20~='' THEN
  4202.   DO
  4203.     Status 'Y'
  4204.     elapsed=RESULT
  4205.     line=line 'Total:'elapsed
  4206.     PARSE VAR elapsed thour':'tmin':'.
  4207.     PARSE VAR data.19 dhour 'hours' dmin 'minutes in' calls .
  4208.     IF ~DATATYPE(tmin,'N')  THEN tmin=0
  4209.     IF ~DATATYPE(thour,'N') THEN thour=0
  4210.     IF ~DATATYPE(dhour,'N') THEN dhour=0
  4211.     IF ~DATATYPE(dmin,'N')  THEN dmin=0
  4212.     IF ~DATATYPE(calls,'N') THEN calls=0
  4213.     IF thour=0 & tmin<3 THEN            /* free call if less than 3 minutes */
  4214.       DO
  4215.         wordloc=WORDINDEX(data.11,3)-1
  4216.         wordval=WORD(data.11,3)+1
  4217.         data.11=DELWORD(data.11,3,1)
  4218.         data.11=INSERT(wordval' ',data.11,wordloc)
  4219.       END
  4220.     mins=thour*60+tmin+countcheck(bbspath'Numbers/Minutes' 0)
  4221.     cals=countcheck(bbspath'Numbers/Calls' 0)+1
  4222.     CALL countcheck(bbspath'Numbers/Minutes' mins);
  4223.     CALL countcheck(bbspath'Numbers/Calls' cals);
  4224.     thour=thour+dhour
  4225.     tmin=tmin+dmin+1
  4226.     IF tmin>59 THEN
  4227.       DO
  4228.         thour=thour+tmin%60
  4229.         tmin=tmin//60
  4230.       END
  4231.     data.19=thour 'hours' tmin 'minutes in' calls+1 'calls.'
  4232.     CALL SETCLIP('BBS_elapsed',elapsed)
  4233.     CALL SETCLIP('BBS_userlogoff',TIME('C') DATE())
  4234.     CALL postuser(6);
  4235.     ADDRESS AREXX bbsUSAGE.baud
  4236.     CALL saveData(1)
  4237.   END
  4238.  
  4239. OUT2:
  4240. CALL send2log(line);
  4241.  
  4242. DONE:
  4243. CALL send2log('')
  4244.  
  4245. DONE2:
  4246. Remote OFF
  4247. dcd
  4248. IF RC~=0 THEN Send '\ah'
  4249. baud maxbps
  4250. Data startdir
  4251. Set F
  4252. CALL SETCLIP('BBS_level')
  4253. CALL SETCLIP('BBS_minutes')
  4254. Send 'ATZ\r'  /* reset modem */
  4255. EXIT;
  4256.  
  4257.  
  4258. getbaudrate: PROCEDURE
  4259. TRACE OFF
  4260. BaudRate
  4261. brate=RC
  4262. TRACE
  4263. RETURN(brate);
  4264.  
  4265.  
  4266. /* end of BBBBS.baud */
  4267.  
  4268.  
  4269. /*-------  Userfile Data definition  ---  v=view  e=edit ----------------*/
  4270.  
  4271. ve  1 name
  4272. ve  2 address
  4273. ve  3 city state country zip
  4274. ve  4 telephone
  4275. ve  5 password
  4276. ve  6 protocol
  4277. ve  7 lines per page
  4278. ve  8 Preferences: MENUS COLOR STREET PHONE etc. On list=YES, ON or PUBLIC.
  4279. ve  9 Computer model
  4280. ve 10 interests        ! SYSOP edit only below this line !
  4281. v  11 nn minutes n more times today  (typically 60 mins 3 times/day).
  4282. v  12 first date on.  timestamp  age
  4283. v  13 last  date on BBS in 'S' form for rexx DATE().
  4284. v  14 uploaded files bytes lastdate
  4285. v  15 downloaded files bytes lastdate
  4286. v  16 lastfilebrowsed lastfilelistdate lastfilelisttime
  4287. v  17 ul:dl_ratio  total_email_written
  4288. v  18 winnings  
  4289. v  19 total time on this BBS in hours minutes calls
  4290. v  20 level
  4291.    21 exclude dirs by name (conferences by number), separated by spaces.
  4292.    22 oldest messages read
  4293.    23 total msgs written per conference
  4294.  
  4295. /* end data defines */
  4296.